source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
config.py | from functools import cache
from os.path import exists
from json import load, dump
from singleton import Singleton
from threading import Thread
# for application-specific data
class BaseConfig(metaclass=Singleton):
def __init__(self, logInfoCallback, logErrorCallback, dataFile='config_base.json'):
self.dat... |
http_flood.py | import socket, threading, time
__THREAD_NUMBER__ = 500
def http_flood(ip: str, port: str, timeout: str):
def flood(ip: str, port: int, timeout: int):
start_time = int(time.time())
while int(time.time()) - start_time < timeout:
try:
sock = socket.socket(socket.AF_INET, ... |
ffmpeg.py | import subprocess
import threading
import time
from abc import ABC
from typing import Optional, Tuple
from PIL.Image import Image
from platypush.plugins.camera.model.camera import Camera
from platypush.plugins.camera.model.writer import VideoWriter, FileVideoWriter, StreamWriter
class FFmpegWriter(VideoWriter, ABC... |
Server.py | import FSGDP
import multiprocessing as mp
import logging
import time
adress_box = {
32:(13, 15),
42:(19, 21),
}
def get_data(pins):
pin1, pin2 = pins
Recv = FSGDP.Receiver(pin1, pin2)
print ("Waiting for response")
meta, notinuse = Recv.receive()
to_adress = str(meta[0]).replace("[", "... |
oase_apply.py | # Copyright 2019 NEC 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 agreed to in writi... |
csvwriter.py | from typing import List, Any, Sequence, Callable, IO
import threading
import queue
import csv
# marking a child classes method with overrides makes sure the method overrides a parent class method
# this check is only needed during development so its no problem if this package is not installed
# to avoid errors we need... |
test_operator.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... |
safe_t.py | from binascii import hexlify, unhexlify
import traceback
import sys
from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING
from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum.bip32 import BIP32Node
from electrum import constants
from electr... |
main.py | #!/usr/bin/env python
#### /usr/bin/python3.4
#Communicate with end devices via LoRa.
#Communicate with server via MQTT(hbmqtt) and HTTP POST.
#Save data in the sqlite database.
#Parse JSON from MQTT and LoRa protocol.
#Communication module: LoRa.
#Communication method with device via LoRa.
#Uart port drive LoRa modul... |
scrapper.py | from time import sleep
from multiprocessing import Process
import os
import time
import datetime
import csv
import logging
import rsc.functions as scrapper
import rsc.helper as helper
def main():
helper.cls()
#imdbscrapper(903747,903733)
remDuplicates = int(os.getenv('removeDuplicates', 0)) ... |
server.py | import socket
import threading
import pickle
import time
import traceback
import json
HEADER = 64
PORT = input("Type a port >> ")
if PORT == "":
PORT = 49001 #Default port
try:
PORT = int(PORT)
except:
print("Not a valid port. running on default port...")
SERVER = "0.0.0.0"
ADDR = (SERVER, PORT)
FORMAT = ... |
video_capture.py | import cv2
import threading
class VideoCaptureAsync:
def __init__(self, src=0, width=480, height=360, driver=None):
self.src = src
if not driver:
self.cap = cv2.VideoCapture(self.src)
else:
self.cap = cv2.VideoCapture(self.src, driver)
self.cap.set(cv2.CAP_... |
router-gather-data.py | #!/usr/bin/env python3
# We need to run in python 3.3+
import netmiko
import progressbar
import csv
import multiprocessing
from multiprocessing import Pool
from getpass import getpass
import threading
import signal
import time
import sys
def getRouterData(routerIP,username,password):
# This function is called in ... |
server.py | import socket
import threading
import pickle
import fuid
from . import common
from typing import Any
class Server:
def __init__(self):
self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.connections = []
self.listeners = []
self.fuid = fuid.Generator()
def __ha... |
app.py | import sys
if 'threading' in sys.modules:
raise Exception('threading module loaded before patching!')
import gevent.monkey; gevent.monkey.patch_thread()
from threading import Thread
from multiprocessing import Process
import time
from flask import Flask, render_template, session
from flask_socketio import Socket... |
simple_crawler.py | import copy
import threading
from six.moves import urllib
class SimpleCrawler(object):
_results = {}
@staticmethod
def fetch_url(url, timeout=None):
"""
Crawls the html content of the parameter url and returns the html
:param url:
:param timeout: in seconds, if None, the ... |
io.py | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
main.py | # Super simplistic weight transmitter simulator
# TODO: stable/unstable, etc
import serial
ser = serial.Serial("COM5", 9600, timeout=0)
from time import sleep
import sys
import threading
import time
import queue
def add_input(input_queue):
while True:
input_queue.put(sys.stdin.read(1))
input_queue = que... |
data_util.py | import multiprocessing
import threading
import time
from multiprocessing import Queue
import numpy as np
class GeneratorEnqueuer():
def __init__(self, generator,wait_time=0.05, random_seed=None):
self.wait_time = wait_time
self._generator = generator
self._threads = []
self._stop_event = None
se... |
inputhook.py | """
Similar to `PyOS_InputHook` of the Python API, we can plug in an input hook in
the asyncio event loop.
The way this works is by using a custom 'selector' that runs the other event
loop until the real selector is ready.
It's the responsibility of this event hook to return when there is input ready.
There are two w... |
module_process.py | # Copyright 2019 ICON 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 law or agreed to in writi... |
yolo_test_threaded.py | #Code based on work by PINTO at
#https://github.com/PINTO0309/OpenVINO-YoloV3
#
#Threaded by Les Wright 28 December 2018
import sys, os, cv2, time
import numpy as np, math
from openvino.inference_engine import IENetwork, IEPlugin
from multiprocessing import Process
from multiprocessing import Queue
m_input_size = 416
... |
MaxLatestVersion.py | print ("""
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
┃ ✯͜͡❂➣ PC Windows + IOS IPAD + CHOME OS + WIN10
┃ ✯͜͡❂➣ เครดิตการแก้ ( ห้ามเปลี่ยนส่วนนี้ )
┃ ✯͜͡❂➣ ไลน์ไอดี :: http://line.me/ti/p/%40jnx0914l
┃ ✯͜͡❂➣ ลิขสิทธิ์ :: http://github.com/teambotmax
┃ ✯͜͡❂➣ ประเทศ :: ไทย ( Thailand )
┃ ✯͜͡❂➣ ผู้สร้าง :: แม็กซ์ บินแหลก ( T... |
test_failure.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import logging
import os
import sys
import tempfile
import threading
import time
import numpy as np
import pytest
import redis
import ray
import ray.ray_constants as ray_constants
from ray.cluster... |
block.py |
# Copyright (c) 2016-2020, The Bifrost Authors. 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 must retain the above copyright
# notice, this list of conditi... |
explorer.py | import argparse
import qt
import requests
import docscraper
from functools import partial
import threading
class EasyLayout():
"""Base class for layout wrappers.
These wrappers provide several conveniences:
1. Constructor takes margin as a keyword argument so it can easily be
changed.
2. Margin defaults to ... |
test_tools.py | # Copyright 2015-2019, Damian Johnson and The Tor Project
# See LICENSE for licensing information
"""
Helper functions for testing.
Our **stylistic_issues**, **pyflakes_issues**, and **type_check_issues**
respect a 'exclude_paths' in our test config, excluding any absolute paths
matching those regexes. Issue strings ... |
service_streamer.py | # coding=utf-8
# Created by Meteorix at 2019/7/13
import multiprocessing
import os
import threading
import time
import uuid
import weakref
import pickle
from queue import Queue, Empty
from typing import List
from redis import Redis, RedisError
from loguru import logger
from .managed_model import ManagedModel
TIMEOUT... |
zhima.py | #!/usr/bin/env python3
""" Controller module
- Waits for the proximity detector to trigger the photo taking.
- Photos are scanned for QR Code
- QR code is match against a database of members
- if the member is OK then the door open else an email is triggered
Normal LED flashing:
Green 1: flash while waiting for proxi... |
execute.py | import os
import sys
from flask import Flask
import requests as r
import time
import json
from signal import signal, SIGINT
import threading
from datetime import datetime
import numpy as np
import math
##globals##
threads = 8
threadL = []
orderAddr = []
order = []
startTimes = []
mainThread = None
... |
HWF.py | import flatbuffers
import websocket as ws
import sys
import os
import threading
import time
sys.path.append(".")
sys.path.append("../.")
# script_dir = os.path.dirname( __file__ )
# schema_dir = os.path.join( script_dir, '..', 'schema')
# sys.path.append( schema_dir )
import schema.GetHardwarePool as FbGetHardwareP... |
train.py | import argparse
import logging
import math
import os
import random
import time
from pathlib import Path
from threading import Thread
import numpy as np
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
impo... |
transcriber.py | import json
import ssl
import threading
try:
from urllib.parse import urlparse
from urllib.parse import urlencode
except ImportError: # python 2
from urlparse import urlparse
from urllib import urlencode
import fluteline
import requests
import websocket
AUTH_API = 'https://iam.bluemix.net/identity/to... |
generate_data.py | import random
import threading
from time import sleep
from django.contrib.auth.models import User
from models import TestModel
def generate_queries():
u1 = User.objects.filter()
new_name = str(random.randint(0, 2000000))
if u1:
u1.update(first_name=new_name)
else:
u1 = User(username... |
room_seeker_navi1.py | #!/usr/bin/env python
# coding: utf-8
#==================================================================================================#
# #
# FILE : room_seeker_navi1.py ... |
scanner.py | # from nfc.clf import RemoteTarget
from cacbarcode import PDF417Barcode, Code39Barcode
from attendance import MockAttendance, StatusValues
import graphics, sys, random
import time
import threading
def getEDIPI(data):
edipi = ""
try:
barcode = PDF417Barcode(data)
edipi = barcode.edipi
excep... |
hexo.py | import tkinter
import os
from win32api import GetSystemMetrics
from threading import Thread
class Hexo:
command_dict = {'g': 'hexo g', 's': 'hexo s', 'd': 'hexo d', 'clean': 'hexo clean',
'not s': 'hexo clean'}
over_dict = {'g': '初始化成功~', 's': 'Hexo已开启~', 'd': 'Hexo已提交~', 'clean':... |
Pipeline.py | # coding=utf-8
# coding=utf-8
from appJar import gui
import time
import os
import subprocess
import sys
from sys import argv
from subprocess import call
import glob
import shutil
from argparse import (ArgumentParser, FileType)
import logging
import yaml
import re
import thread
import threading
from threading import Thr... |
ClientExample.py | # --coding:utf-8--
#
# Copyright (c) 2019 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License,
# attached with Common Clause Condition 1.0, found in the LICENSES directory.
"""
Nebula Client example.
"""
import sys
import time
import threading
import prettytable
from graph impo... |
irc.py | import re
import socket
import time
import thread
import Queue
from ssl import wrap_socket, CERT_NONE, CERT_REQUIRED, SSLError
def decode(txt):
for codec in ('utf-8', 'iso-8859-1', 'shift_jis', 'cp1252'):
try:
return txt.decode(codec)
except UnicodeDecodeError:
continue
... |
tools.py | #!/usr/bin/env python
import re
import string
from urlparse import urlparse, urljoin
from functools import wraps
from threading import Thread
from app import db
from app.models import Annotation
from flask import request, url_for, current_app
def land_url():
return url_for("main.land")
def home_url():
re... |
remove_cluster_tags.py | from datetime import datetime
from multiprocessing import Process, Queue
import boto3
from cloud_governance.common.aws.cloudtrail.cloudtrail_operations import CloudTrailOperations
from cloud_governance.common.aws.ec2.ec2_operations import EC2Operations
from cloud_governance.common.aws.iam.iam_operations import IAMOpe... |
test_discovery_and_monitoring.py | # Copyright 2014-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
threads.py | #!/usr/bin/env python
"""
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import difflib
import random
import threading
import time
import traceback
from lib.core.data import conf
from lib.core.data import kb
from... |
experiment.py | # Copyright 2016 Raytheon BBN Technologies
#
# 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
import os
import sys
import uuid
import json
if ... |
xslack.py | import json
import re
import threading
import time
import urllib
import requests
from slackclient import SlackClient
config = dict()
c = threading.Condition()
threads = dict()
shared_files = dict()
def run(token, other_tokens, channel_names):
print(other_tokens)
print(channel_names)
members = dict()
... |
smart_event.py | """Module smart_event.
=============
SmartEvent
=============
You can use the SmartEvent class to coordinate activities between two
threads by using either of two schemes:
1) ``wait()`` and ``resume()``
2) ``sync()``.
With ``wait()``/``resume()``, one thread typically gives another
thread a task to do and t... |
acquire.py | import numpy as np
import multiprocessing
import threading
from inspect import signature
import copy
import types
import time
from pycromanager.core import serialize_array, deserialize_array, Bridge
from pycromanager.data import Dataset
import warnings
import os.path
import queue
### These functions outside class to p... |
workload_C.py | """
This workload presents a simple interface that can be reused in other workloads.
It summary, it runs several subprocesses using the multiprocessing package,
makes the connections between them, and then starts working.
This particular workload spawns NETWORK_SIZE machines, two of which are
proposers. We can run wi... |
test_dag_serialization.py | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
old_ssh.py | import logging
import socket
import os
import sys
import time
import traceback
try:
from queue import Queue
except ImportError: # Python 2.7 fix
from Queue import Queue
from threading import Thread
from toolz import merge
from tornado import gen
logger = logging.getLogger(__name__)
# These are handy fo... |
utils.py | # STL imports
import random
import string
import struct
import sys
import time, datetime
import copy
import numpy as np
from utils import *
from milvus import Milvus, IndexType, MetricType
def gen_inaccuracy(num):
return num/255.0
def gen_vectors(num, dim):
return [[random.random() for _ in range(dim)] for _... |
mixins.py | # Copyright The OpenTelemetry Authors
#
# 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 ... |
test.py | import os.path as p
import random
import threading
import time
import pytest
from helpers.cluster import ClickHouseCluster
from helpers.test_tools import TSV
from helpers.client import QueryRuntimeException
from helpers.network import PartitionManager
import json
import subprocess
import kafka.errors
from kafka impor... |
tcp_srv_thread.py | # -*- coding: utf-8 -*-
#
import optparse
import os
import socket
import time
from threading import Thread
import StringIO
txt = '''1111
2222
3333
4444
'''
def server(listen_socket):
while True:
buf = StringIO.StringIO(txt)
sock, addr = listen_socket.accept()
print 'Some... |
test_streams.py | """Tests for streams.py."""
import contextlib
import gc
import io
import os
import queue
import pickle
import socket
import sys
import threading
import unittest
from unittest import mock
from test import support
try:
import ssl
except ImportError:
ssl = None
import asyncio
from asyncio.streams import _StreamP... |
ipc_queue.py | # coding: utf-8
import multiprocessing
import time
import os
def inputq(queue):
info = str(+os.getpgid()) + ' put: ' + str(time.ctime())
queue.put(info)
time.sleep(2)
info = queue.get()
print info
def outputq(queue):
info = queue.get()
print info
queue.put(str(ti... |
compare.py | import threading
import psutil
def monitorMemory():
proc = psutil.Process()
print(proc.memory_info().rss)
def monitorCPU():
print(psutil.cpu_percent())
def runTestScript(path_to_script):
# test script running code
print("running")
if __name__ == "__main__":
thread1 = threading.Thread(target=... |
simulate.py | from ._tumorutil import tumor2d_simulate
import numpy as np
from multiprocessing import Process, Pipe
MAX_SEED = 2147483647
def nr_valid(arr):
return len(arr) - len(np.nonzero((arr[::-1] == 0).cumprod())[0])
def simulate(division_rate=4.17e-2,
initial_spheroid_radius=1.2e1,
initial_quie... |
ffmpeg_pipeline.py | '''
* Copyright (C) 2019-2020 Intel Corporation.
*
* SPDX-License-Identifier: BSD-3-Clause
'''
import string
import shlex
import subprocess
import time
import copy
from threading import Lock
from threading import Thread
import shutil
import re
from collections import OrderedDict
from collections import namedtuple
from... |
repo_manager.py | # ===============================================================================
# Copyright 2013 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/licenses... |
promote_images.py | #!/usr/bin/env python3
#
# Copyright 2018 The Bazel 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 ... |
demo.py | # -*- coding:utf-8 -*-
# @Time : 2019/10/10 10:57
# @Author : Dg
import datetime
import time
from multiprocessing import Process
def sleep(data):
time.sleep(data)
print("休息{}秒".format(data))
if __name__ == "__main__":
print(datetime.datetime.now())
p1 = Process(target=sleep, args=(3, ))
p2 = P... |
about_websocket_threading.py | # -*- coding: utf8 -*-
__author__ = 'wangqiang'
'''
基于多线程实现1对多的websocket
一个server,多个client
'''
import websockets
import threading
import asyncio
import time
import uuid
import random
def start_server(host, port):
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.run_until_complete(websoc... |
Renderer.py | ##########################################################################
#
# Copyright (c) 2007-2013, Image Engine Design Inc. All rights reserved.
# Copyright (c) 2011, John Haddon. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided ... |
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_bigquery.py | import unittest
import os
import threading
from test.support import EnvironmentVarGuard
from urllib.parse import urlparse
from http.server import BaseHTTPRequestHandler, HTTPServer
from google.cloud import bigquery
from google.auth.exceptions import DefaultCredentialsError
from kaggle_gcp import KaggleKernelCredentia... |
update_config.py | #!/usr/bin/env python2
# Copyright 2018-present Barefoot Networks, Inc.
# SPDX-License-Identifier: Apache-2.0
import argparse
from time import sleep
import grpc
from p4.v1 import p4runtime_pb2
from p4.config.v1 import p4info_pb2
from p4.tmp import p4config_pb2
import google.protobuf.text_format
import struct
import ... |
core.py | # -*- coding: utf-8 -*-
"""
envoy.core
~~~~~~~~~~
This module provides envoy awesomeness.
"""
import os
import sys
import shlex
import signal
import subprocess
import threading
__version__ = '0.0.2'
__license__ = 'MIT'
__author__ = 'Kenneth Reitz'
def _terminate_process(process):
if sys.platform == 'win32':
... |
Piscord.py | import aiohttp
import asyncio
from threading import Thread
from .Events import Events
from .Errors import *
from .API_Elements import *
from .Voice import *
from .Gateway import *
class Utility:
def get_self_user(self):
return User(self.api("/users/@me", "GET"), self)
def get_self_guilds(self):
return [Guild(... |
post_processing.py | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import json
import multiprocessing as mp
from utils import iou_with_anchors
def load_json(file):
with open(file) as json_file:
data = json.load(json_file)
return data
def getDatasetDict(opt):
df = pd.read_csv(opt["video_info"])
... |
18.Controlling Access to Resources.py | # In addition to synchronizing the operations of threads,
# it is also important to be able to control access to shared resources to prevent corruption or missed data.
# Python’s built-in data structures (lists, dictionaries, etc.) are thread-safe as a side-effect of having atomic
# byte-codes for manipulating them ... |
starvation.py | '''
Tiene como propósito estudiar el starvation de los threads al consumir un recurso compartidos.
'''
#!/usr/bin/env python3
""" Three philosophers, thinking and eating sushi """
import threading
chopstick_a = threading.Lock()
chopstick_b = threading.Lock()
chopstick_c = threading.Lock()
sushi_count = 5000
def ... |
test_inference_opencv.py | from keras import backend as K
from keras.models import load_model
from keras.preprocessing import image
from keras.optimizers import Adam
#from imageio import imread
import numpy as np
import random
import cv2
#from matplotlib import pyplot as plt
from models.keras_ssd300 import ssd_300
from keras_loss_function.keras... |
uwb_sniffer.py | #!/usr/bin/env python
import os
import re
import sys
import time
import queue
import signal
import struct
import logging
import threading
from argparse import ArgumentParser
from binascii import a2b_hex
from distutils.sysconfig import get_python_lib
from serial import Serial, serialutil
from serial.tools.list_ports im... |
relay_integration.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... |
bkapp.py | """
Analyze COVID-19 cases and deaths in the US.
"""
import os
import time
import asyncio
import logging
from threading import Thread
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from bokeh import __version__
from bokeh.palettes import Greens
from bokeh.models import Div
from bokeh... |
test_remote_peas.py | import asyncio
import multiprocessing
import os
import pytest
from daemon.clients import AsyncJinaDClient, JinaDClient
from daemon.models.id import DaemonID
from jina import Client, Document, __docker_host__
from jina.enums import PeaRoleType, PollingType, replace_enum_to_str
from jina.helper import random_port
from ... |
sphinxMain.py | ###### RESET AUDIO CARD BEFORE RUNNING ##############
import os, sys, time, webbrowser
from demo import *
from multiprocessing import Process
directory = "/home/pi/pocketsphinx-0.8/src/programs \n"
tf=open('stt.txt','w')
tf.write("begin")
tf.close()
dic = "3145"
def listen():
bscript = "./contRec2... |
tello.py | import socket
import threading
import time
from stats import Stats
import TelloPro
class Tello:
def __init__(self):
self.local_ip = ''
self.local_port = 8889
self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # socket for sending cmd
self.socket.bind((self.lo... |
profileclient.py | import os, sys, json, platform, copy
import tkinter as tk
from tkinter import messagebox
from tkinter import font as tkFont
from tkinter import ttk
import threading
import logging
from .. import logutil
from .. import profileutil
from .. import autoprofiles
from .. import auditmethods
from . import selectlist
logger =... |
test_signal.py | import enum
import errno
import os
import random
import signal
import socket
import statistics
import subprocess
import sys
import threading
import time
import unittest
from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok, spawn_python
try:
import _test... |
basic_threading_demo_with_lock.py | import tkinter as tk
from threading import Thread, Lock
from time import sleep
print_lock = Lock()
def print_slowly(string):
#print_lock.acquire()
with print_lock:
words = string.split()
for word in words:
sleep(1)
print(word)
#print_lock.release()
class App(tk.Tk):
def __init__(self):
... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
from test import support
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import urllib.request
import threading
import traceback
import asyncore
import weakref
import platform
i... |
__init__.py | # Copyright 2017 Mycroft AI 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 writin... |
bot.py | from telegram.ext import Updater, CommandHandler
import threading
import feedparser
import json
import re
config_file = open("config.json")
config = json.load(config_file)
config_file.close()
# TODO: Is there a better place to store this than in a global?
try:
feed_heads_infile = open("feed_heads.json")
FEED_... |
host.py | #copyright © 2019-2021 manoharkakumani
import socket
import sys
import os
import threading
import time
import shutil
import cv2
import pyautogui
import pickle
import struct
import numpy as np
from queue import Queue
THREADS = 2
proc = [1, 2]
queue = Queue()
allconnections = []
alladdress = []
#banner
print("**********... |
renderer.py | """
Renders the command line on the console.
(Redraws parts of the input line that were changed.)
"""
from __future__ import unicode_literals
from prompt_toolkit.eventloop import Future, From, ensure_future, get_event_loop
from prompt_toolkit.filters import to_filter
from prompt_toolkit.formatted_text import to_format... |
serve.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import abc
import argparse
import json
import logging
import os
import platform
import signal
import socket
import sys
import threading
import time
import traceback
from six.moves import urllib
import uuid
from collections import defaultdict, OrderedDict
f... |
kernel_server.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 use ... |
9_rms_wait_die_NS.py | from functools import reduce
from sys import *
import numpy as np
import random as r
import ping_code as pc
import socket
import struct
import subprocess as sp
import threading
from threading import Thread
import ast
import time
import datetime as dt
import os
import psutil
import getpass as gp
from netifaces import in... |
__init__.py | """
nwebsocket
~~~~~~~~~~
WebSocket client without async.
"""
import time
import curio
import threading
from curio import Queue, UniversalQueue
from wsproto.events import (
AcceptConnection,
CloseConnection,
RejectConnection,
)
from .events import ws_socket_manage
__version__ = '1.0.0'
class WebSock... |
main.py | from TwitterAnalysis.TwitterProducer import TwitterProducer
from TwitterAnalysis.TwitterConsumer import TwitterConsumer
from multiprocessing import Process
def ProducerTweetsData():
twitter_producer = TwitterProducer('computer-science')
twitter_producer.CollectTweets
def ConsumeTweetsData():
twitter_consumer = ... |
wrappers.py | import atexit
import functools
import sys
import threading
import traceback
import cv2
import gym
import numpy as np
from PIL import Image
try:
import car_environment
except ImportError:
pass
class DeepMindControl:
def __init__(self, name, size=(64, 64), camera=None):
domain, task = name.split(... |
bridge.py | #!/usr/bin/env python3
# type: ignore
import time
import math
import atexit
import numpy as np
import threading
import random
import cereal.messaging as messaging
import argparse
from common.params import Params
from common.realtime import Ratekeeper
from lib.can import can_function, sendcan_function
from lib.helpers i... |
onedimension_simulation.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# SPDX-License-Identifier: GPL-3.0
#
# GNU Radio Python Flow Graph
# Title: onedimension_simulation
# Author: citizenrich
# GNU Radio version: 3.8.2.0
from distutils.version import StrictVersion
if __name__ == '__main__':
import ctypes
import sys
if sys.pl... |
engine.py | import logging
import smtplib
from abc import ABC
from datetime import datetime
from email.message import EmailMessage
from queue import Empty, Queue
from threading import Thread
from typing import Any
from vnpy.event import Event, EventEngine
from .app import BaseApp
from .event import (
EVENT_TICK,
EVENT_ORD... |
tesseract.py | import tempfile
import threading
from functools import partial
from logging import getLogger
from pathlib import Path
from subprocess import Popen, PIPE, DEVNULL, STDOUT
from sys import platform as _platform
import requests
import re
from kivymd.toast import toast
from kivymd.uix.boxlayout import MDBoxLayout
from kivy... |
wordnet_app.py | # Natural Language Toolkit: WordNet Browser Application
#
# Copyright (C) 2001-2021 NLTK Project
# Author: Jussi Salmela <jtsalmela@users.sourceforge.net>
# Paul Bone <pbone@students.csse.unimelb.edu.au>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
A WordNet Browser application whic... |
main.py | import argparse
import time
import queue
import signal
import threading
from pathlib import Path
import cv2
import depthai as dai
print('depthai module: ', dai.__file__)
import numpy as np
from imutils.video import FPS
parser = argparse.ArgumentParser()
parser.add_argument('-nd', '--no-debug', action="store_true", he... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.