source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
synchronize.py | '''
Synchronize
Passing ball game
1. one is not locked and the rest are locked
2. 1st says that I lock myself, and execute some codes, then unlock 2nd
3. 2nd says that I lock myself, and execute some codes, then unlock 3rd
3. 3rd says that I lock myself, and execute some codes, then unlock 1st
... |
scan_beyond_gap.py | #!/usr/bin/env python3
# Oregano - lightweight Ergon client
# Copyright (C) 2019 calin.culianu@gmail.com
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including wit... |
switchcontroller.py | #!/usr/bin/python3
""" DIYHA Alarm Controller:
Manage a simple digital high or low GPIO pin.
"""
# The MIT License (MIT)
#
# Copyright (c) 2020 parttimehacker@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Soft... |
Procesos.py | from queue import Queue
from threading import Thread
from horno.utiles.Singleton import Singleton
#===================================================================================================
class ThreadManager (metaclass=Singleton):
#---------------------------------------------------------------------... |
snva.py | import argparse
import logging
from logging.handlers import QueueHandler, SocketHandler
from multiprocessing import Process, Queue
import os
import platform
from queue import Empty
import signal
import socket
from subprocess import PIPE, Popen
from threading import Thread
from time import sleep, time
from utils.io impo... |
reader.py | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
dirTrav.py | #!/usr/bin/python
#ONLY WEB HAS BEEN IMPLEMENTED
#If /usr/share/dotdotpwn/Reports exists, dotdotpwn will automatically put raw results in there for you
#Reconscan.py creates the Reports directory for you
import sys
import os
import subprocess
from subprocess import CalledProcessError
import argparse
import multiproce... |
lambda_executors.py | import os
import re
import sys
import glob
import json
import time
import logging
import threading
import traceback
import subprocess
import six
import base64
from multiprocessing import Process, Queue
try:
from shlex import quote as cmd_quote
except ImportError:
from pipes import quote as cmd_quote # for Pyth... |
rall.py | import os
# os.environ['CUDA_VISIBLE_DEVICES'] = '6'
from facenet_pytorch import MTCNN
from core.options import ImageFittingOptions
import cv2
import face_alignment
import numpy as np
from core import get_recon_model
import os
import torch
import core.utils as utils
from tqdm import tqdm
import core.losses... |
test_nntplib.py | import io
import socket
import datetime
import textwrap
import unittest
import functools
import contextlib
import os.path
import re
import threading
from test import support
from nntplib import NNTP, GroupInfo
import nntplib
from unittest.mock import patch
try:
import ssl
except ImportError:
... |
test_api.py | import a0
import aiohttp
import asyncio
import base64
import enum
import json
import os
import pytest
import shutil
import subprocess
import threading
import types
try:
from pytest_cov.embed import cleanup_on_sigterm
except ImportError:
pass
else:
cleanup_on_sigterm()
pytestmark = pytest.mark.asyncio
cl... |
wsconfig.py | # http://www.html.it/pag/53419/websocket-server-con-python/
# sudo -H easy_install tornado
import tornado.httpserver
import tornado.websocket
import tornado.ioloop
import tornado.web
import socket
import time
import os
import yaml
from threading import Thread
import sys
sys.path.append('../program')
sys.path.append(... |
reader_writer_queue_np.py | """
https://stackoverflow.com/questions/11515944/how-to-use-multiprocessing-queue-in-python
1. Classic Producer - Consumer problem (https://en.wikipedia.org/wiki/Producer%E2%80%93consumer_problem)
2. Python multiprocessing
3. Pytorch multiprocessing
4. Bounded Buffer problem
"""
import os
import sys
import time
from ... |
pyterm.py | #!/usr/bin/env python3
"""Simple Python serial terminal
"""
# Copyright (c) 2010-2020, Emmanuel Blot <emmanuel.blot@free.fr>
# Copyright (c) 2016, Emmanuel Bouaziz <ebouaziz@free.fr>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided th... |
HardwareInterface.py | import odrive
from odrive.enums import *
from woofer.Config import RobotConfig
from woofer.HardwareConfig import (
ODRIVE_SERIAL_NUMBERS,
ACTUATOR_DIRECTIONS,
ANGLE_OFFSETS,
map_actuators_to_axes,
)
import time
import threading
import numpy as np
class HardwareInterface:
def __init__(self):
... |
bridge.py | #!/usr/bin/env python3
import argparse
import math
import os
import signal
import threading
import time
from multiprocessing import Process, Queue
from typing import Any
import carla # pylint: disable=import-error
import numpy as np
import pyopencl as cl
import pyopencl.array as cl_array
import cereal.messaging as m... |
tree height.py | # python3
import sys
import threading
sys.setrecursionlimit(10**7) # max depth of recursion
threading.stack_size(2**27) # new thread will get stack of such size
class TreeHeight:
def read(self):
self.n = int(sys.stdin.readline())
self.parent = list(map(int, sys.stdin.readline().split()))
... |
zeromq.py | # -*- coding: utf-8 -*-
'''
Zeromq transport classes
'''
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import os
import sys
import copy
import errno
import signal
import socket
import hashlib
import logging
import weakref
import threading
from random import randint
# Im... |
tests.py | import sys
import threading
import time
from unittest import skipIf, skipUnless
from django.db import (
DatabaseError, Error, IntegrityError, OperationalError, connection,
transaction,
)
from django.test import (
TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature,
)
from .models import Reporter
@... |
Main.py | from threading import Thread
from time import sleep
from os import path, walk, urandom
from src import variable as v, webcontrol as wc, functions as f, core, admin
from tinydb import TinyDB, Query
import waitress
core.v = wc.v = f.v = v
wc.core = core
v.db = TinyDB("db.tinydb")
v.query = Query()
v.Log =... |
microtvm_api_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 u... |
rms.py |
import threading
import sys
if sys.version_info[0] < 3:
import Queue as queue
else:
import queue
import numpy as np
import audioop
import pyaudio
from voice_engine.element import Element
from voice_engine.file_sink import FileSink
class Source(Element):
def __init__(self, rate=16000, frames_size=None)... |
index.py | import logging
from flask import Flask, request
from flask_cors import CORS
from flask import jsonify
from functools import wraps
from utils import config
import authentication
import router
import time
from multiprocessing import Process
app = Flask(__name__, instance_relative_config=True)
# Server starter
def fl... |
kglib.py | #!/usr/bin/env python
"""
================================================================================
Keyglove Protocol Python interface library
2014-12-06 by Jeff Rowberg <jeff@rowberg.net>
Changelog:
2014-12-06 - Separated communication code from parser/generator code
- Added transparent sup... |
client.py | import Queue
import time
import socket
import sys
import random
from threading import Thread
import random
import datetime
class Frame:
def __init__(self, type, num, data):
self.type = type
self.num = str(num)
self.data = data
if (data == None):
# if(type == 'ACK'):
... |
worker_app.py | """
This module defines the rq worker methods.
"""
import multiprocessing
import logging
from time import sleep
import os
from redis import Redis
from rq import Queue, Connection, Worker, get_current_job
import nest_py.core.nest_config as nest_config
from nest_py.core.data_types.nest_id import NestId
import nest_py.k... |
tf_api_test.py | import cv2
import numpy as np
import pandas as pd
import time
import sys, os
from datetime import datetime
from pprint import pprint
import imageio
# import threading
# import queue as queue
from threading import Thread as Process
from threading import Lock
# from multiprocessing import Process, Lock
try:
sys.p... |
test_enum.py | import enum
import doctest
import inspect
import os
import pydoc
import sys
import unittest
import threading
from collections import OrderedDict
from enum import Enum, IntEnum, StrEnum, EnumType, Flag, IntFlag, unique, auto
from enum import STRICT, CONFORM, EJECT, KEEP, _simple_enum, _test_simple_enum
from enum import ... |
test_cuda.py | from itertools import repeat, chain, product
from typing import NamedTuple
import collections
import gc
import io
import os
import pickle
import queue
import sys
import tempfile
import threading
import unittest
import torch
import torch.cuda
import torch.cuda.comm as comm
from torch import multiprocessing as mp
from t... |
competition_example.py | #!/usr/bin/env python3
import botbowl
import socket
from botbowl.ai.competition import PythonSocketClient, PythonSocketServer
from multiprocessing import Process
import time
import secrets
import botbowl
import socket
def run_agent(registration_name, port, token):
"""
Starts a server that hosts an agent.
... |
hbc.py | # -*- coding: utf-8 -*-
# No License: This is free and unencumbered software released into
# the public domain.
from PIL import Image
import win32con
import win32api
import win32gui
import win32ui
import sys
import os
import datetime
import threading
import queue
import time
import tkinter
from functools import par... |
common_utils.py | # coding=utf-8
# Copyright 2022 The Google Research 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 applicab... |
ORF.py | from app.settings import os, SeqIO, logger
import tempfile, time, fileinput, math, multiprocessing, shutil
class ORF(object):
"""Class to find open reading frames from nucleotide sequence."""
def __init__(self,input_file, threads, clean=True, working_directory=None, low_quality=False, training_file=None, split_prodi... |
detect_service.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Tencent is pleased to support the open source community by making Metis available.
Copyright (C) 2018 THL 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 th... |
process_tree.py | from __future__ import division, unicode_literals, print_function, absolute_import
import sys
PY2 = sys.version_info.major == 2
import os
import threading
import time
import signal
import weakref
import json
import ctypes
import atexit
from ctypes.util import find_library
import logging
from binascii import hexlify
i... |
manager.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import vim
import os
import sys
import json
import time
import operator
import itertools
import threading
import multiprocessing
from functools import partial
from functools import wraps
from .instance import LfInstance
from .cli import LfCli
from .utils import *
from .fuz... |
07_1_manual_thread.py | #! /root/anaconda3/bin/python
import time
from threading import Thread
from threading import current_thread
print('父线程%s启动' % current_thread().getName())
def do_sth(arg1, arg2):
print('子线程%s启动' % current_thread().getName())
time.sleep(30)
print('arg1 = %d, arg2 = %d' % (arg1, arg2))
print('子线程%s结束' %... |
Mgmt_Server.py | # |**********************************************************************;
# * Project : ESP Testbed Tower - Managment PC.
# *
# * Program name : Mgmt_Server.py
# *
# * Author : Tyler Steane
# *
# * Date created : 21-06-2019
# *
# * Purpose : Managment PC server, co-ordinates a... |
btcomm.py | from __future__ import unicode_literals
import socket
import sys
import errno
from .utils import (
register_spp,
get_mac,
get_adapter_powered_status,
get_adapter_discoverable_status,
get_adapter_pairable_status,
get_paired_devices,
device_pairable,
device_discoverable,
device_power... |
speechSpyGlobalPlugin.py | # A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2018 NV Access Limited
# This file may be used under the terms of the GNU General Public License, version 2 or later.
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html
"""This module provides an NVDA global plugin which creates a and robo... |
qiqo_chat.py | import json
import requests
import threading
import civictechprojects.models
from django.conf import settings
def get_user_qiqo_iframe(contributor):
if not contributor.qiqo_uuid:
SubscribeUserToQiqoChat(contributor)
return settings.TEST_IFRAME_URL
if not hasattr(settings, 'QIQO_IFRAME_URL'):
... |
faber.py | import subprocess
import threading
import time
import requests
import json
import sys
import logging
from flask import Flask, request
def print_menu(): ## Your menu design here
print(30 * "-" , "MENU CATALYST SCHOOL" , 30 * "-")
print("1. Create did:prism")
print("2. Resolve DID")
print("3. Creat... |
word2vec_optimized.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... |
test__core_fork.py | from __future__ import print_function
import gevent.monkey; gevent.monkey.patch_all()
import gevent
import os
import multiprocessing
hub = gevent.get_hub()
pid = os.getpid()
newpid = None
def on_fork():
global newpid
newpid = os.getpid()
fork_watcher = hub.loop.fork(ref=False)
fork_watcher.start(on_fork)
... |
TP81.py | #! /usr/bin/env python3
#encoding: UTF-8
import threading, random, time
# Exemple lancement de thread
# def f(x, y):
# # fonction à exécuter sur un thread à part
# # ...
# pass
#
def tri_bulle(list, lock):
if len(list) <= 1:
return
temp = 0
while temp != None:
temp = None
... |
Threaded_Lockstep_Runner.py | #!/usr/bin/python3
from enum import Flag
import json
import os
import struct
import sys
import glob
from threading import Thread
import subprocess
import time
import multiprocessing
if sys.version_info[0] < 3:
raise Exception("Python 3 or a more recent version is required.")
if (len(sys.argv) < 3):
sys.ex... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import electrum
from electrum.bitcoin import TYPE_ADDRESS
from electrum import WalletStorage, Wallet
from electrum_gui.kivy.i18n import _
from electrum.paymentrequest import InvoiceStore
from electr... |
presenter_agent.py | # !/usr/bin/env python
# -*- coding:utf-8 -*-
import time
from threading import Thread
import sys
from atlas_utils.acl_logger import log_error, log_info
from atlas_utils.presenteragent.socket_client import AgentSocket
import atlas_utils.presenteragent.presenter_message as pm
import atlas_utils.presenteragent.presenter... |
rankingMultiThd.py | #!/usr/bin/python
# This script computes ranking for test.idx, use multithreading to
# improve performance
# Input: /dat/fb15k-intermediate/test_divided/test_[1,2,3,4].idx
# /result/...
# Output: /evaluation/rank15k_i[ITERATION]_d[DIM].txt
import numpy as np
from collections import OrderedDict
import s... |
test_using_open_and_close.py | from threading import Thread
from unittest import TestCase, main
from expects import expect, be_false, be_true
from twin_sister import close_all_dependency_contexts, dependency, \
open_dependency_context
from twin_sister.injection.singleton_class import SingletonClass
class Canary:
def __init__(self):
... |
utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utilities file containing useful functions.
More recent functions are at the top.
Many of these are taken from he korbinian python package by Mark Teese. This is allowed under the permissive MIT license.
"""
import csv
import glob
import logging
import os
import re as r... |
test_messaging.py | #!/usr/bin/env python3
import os
import capnp
import multiprocessing
import numbers
import random
import threading
import time
import unittest
from parameterized import parameterized
from cereal import log, car
import cereal.messaging as messaging
from cereal.services import service_list
events = [evt for evt in log.... |
test_gc.py | import unittest
from test.support import (verbose, refcount_test, run_unittest,
strip_python_stderr, cpython_only, start_threads,
temp_dir, requires_type_collecting, TESTFN, unlink,
import_module)
from test.support.script_helper import assert... |
posts.py | from . import wsinter
from .accounts.profile import profile
from .accounts.records import Record
from .accounts import relations
from .. import consts
from .misc import abc, utils
from .images import Image
from datetime import datetime
import itertools
from bson.objectid import ObjectId
from pymongo.cursor i... |
middle.py | from scapy.all import get_if_hwaddr, get_if_addr, send, ARP, getmacbyip
import ipaddress
from threading import Thread
from scapy.all import sniff, Ether, IP, ARP, TCP, UDP, ICMP
print("Input Interface: ", end="")
iface = input()
ip = get_if_addr(iface)
mac = get_if_hwaddr(iface)
router_ip = "172.16.44.1"
router_mac =... |
board.py | # Copyright 2017 Google 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, ... |
HLRender.py | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 5 07:13:15 2019
@author: steve
"""
from __future__ import print_function
import sys,re,os,json
import PySimpleGUI27 as sg
import subprocess,threading,Queue
ON_POSIX = 'posix' in sys.builtin_module_names
def enqueue_output(out, queue):
for line in iter(out.r... |
testremovekeys.py | import unittest, time
import web, argparse, os, logging, sys
from multiprocessing import Process
import web, argparse, os, logging, sys
from ..client.listcurator import *
from ..service.listcurator import *
from sqlalchemy import *
PORT = 45078
HOST = '0.0.0.0'
ML_SAVE_DIR = 'managed_lists'
SAVE_DIR = os.path.join(os... |
test_request_body.py | import io
import multiprocessing
from wsgiref import simple_server
import requests
import falcon
from falcon import request_helpers
import falcon.testing as testing
SIZE_1_KB = 1024
class TestRequestBody(testing.TestBase):
def before(self):
self.resource = testing.TestResource()
self.api.add_r... |
onlinescreen.py | import threading
from functools import partial
from kivy.uix.screenmanager import Screen
from ui.modals import *
import config
import re
class OnlineScreen(Screen):
def __init__(self, CApp, **kwargs):
super(OnlineScreen, self).__init__(**kwargs)
self.direct_pop = None # Direct match popup fo... |
server.py | import socket
import threading
import socketserver
import time
from actuators import *
from sensors import Sensors
class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
def handle(self):
data = str(self.request.recv(1024), 'ascii')
cur_thread = threading.current_thread()
if(len... |
testloop.py | # TODO merge common tests and Natural Language ones
# default libraries
import os
# user interface
import tkinter as tk
from datetime import datetime
from tkinter import filedialog
from msvcrt import getch
import random
import numpy as np
from scipy.io.wavfile import read, write
from .ABC_weighting import a_weight
#... |
main.py | # -*- coding:utf-8 -*-
# Author: RubanSeven
import cv2
import glob
import os
import tqdm
import imageio
from multiprocessing import Process
import random
from augment import distort, stretch, perspective
from imgaug import augmenters as iaa
import imgaug as ia
import PIL
from PIL import Image
import num... |
input_adapter.py | """
input adapter contains class InputAdapter
that featches messages from server
"""
import threading
import time
import requests
from requests.exceptions import HTTPError
from ..log import logger
from ..config import CONFIG
class InputAdapter:
"""
Fetches the user input from server
and pushes it over pip... |
combat_standalone.py | # The intent of this test is to verify that a standalone combat bot works
# And then incorporate the working standalone back into the v3 test bot
from hsvfilter import grab_object_preset
from windowcapture import WindowCapture
from vision import Vision
import os
import combo
import threading
import time
import pydirect... |
deepracer_memory.py | from threading import Thread
import pickle
import time
import queue
import redis
from rl_coach.memories.backend.memory import MemoryBackend
from rl_coach.core_types import Episode
from markov.utils import Logger, json_format_logger, build_system_error_dict
from markov.utils import SIMAPP_MEMORY_BACKEND_EXCEPTION, SIM... |
service.py | import threading
from projectx.config import ONLY_CLIENT
from projectx.logger import log
from projectx.rpc import server_thread
from projectx.monitor import projectxMonitor
from projectx.daemon import projectxd_thread
from projectx.osarch import PLATFORM
import xbmc
def run():
# Make sure the XBMC jsonrpc server ... |
ck_rl_model.py | # 這個文件直接執行是給GCP用的
from obstacle_tower_env import ObstacleTowerEnv
import numpy as np
import tensorflow as tf
import threading
import queue
# 運行環境設定:
# 設置幾個代理
N_WORKER = 16
# 代理人自己更新的步數
EP_LEN = 500
# 最大訓練回合數(每個代理人加起來的回合)
EP_MAX = N_WORKER * 100
# 設定更新整個模型:每個代理走了N步就更新
UPDATE_STEP = 20 # 本身是循環更新步
MIN_BA... |
ib_wrapper.py | # -*- coding: utf-8 -*-
"""Dynamic TWS-IB API wrapping module to make callings blocking and
avoid user to deal with asyncrhonous world.
"""
# TODO: convert realtimeBar to ibapi.common.BarData
import re
import time
import collections
from functools import reduce
from operator import and_
import inspect
from threading ... |
test_util_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... |
conftest.py | import pytest
import time
from context import HGECtx, HGECtxError, ActionsWebhookServer, EvtsWebhookServer, HGECtxGQLServer, GQLWsClient, PytestConf
import threading
import random
from datetime import datetime
import sys
import os
from collections import OrderedDict
def pytest_addoption(parser):
parser.addoption(
... |
IoTDeviceSimulator.py | '''
This script aims to showcase how to generate measurements for Cumulocity devices.
In this example, we demonstrate necessary steps to generate simulated sensor readings through Cumulocity's REST API.
This example automatically creates devices that host the generated readings.
Please refer to the documentation for... |
test_server.py | """Tests for the HTTP server."""
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8 :
import os
import socket
import tempfile
import threading
import time
import pytest
import cheroot.server
from cheroot.testing import (
ANY_INTERFACE_IPV4,
ANY_INTERFACE_IPV6,
EPHEMERAL_PORT,
)
def make_http_server... |
firehose_sender.py | import boto3 as aws
import threading
import os
import errno
import re
import datetime
import time
import ConfigParser
class FirehoseSender:
def __init__(self, access_key, secret_key, stream_name, max_rows=10, remove_sent=False, json=True):
# type: (basestring, basestring, basestring, int, bool, bool) -> N... |
miscconfig.py | #
# ***** BEGIN LICENSE BLOCK *****
# Zimbra Collaboration Suite Server
# Copyright (C) 2010, 2012, 2013, 2014, 2015, 2016 Synacor, Inc.
#
# 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,
# version... |
writer.py | import os
import time
from threading import Thread
from queue import Queue
import cv2
import numpy as np
import torch
import torch.multiprocessing as mp
import matplotlib.pyplot as plt
import pandas as pd
from alphapose.utils.transforms import get_func_heatmap_to_coord
from alphapose.utils.pPose_nms import pose_nms,... |
plmapp.py | #!/usr/bin/python
# This is a generic module for parallelization ( using Processes )
#
#
#
# How to use This ?
# Create a function that can do what you want to achieve with 1 parameter or 1 set of parameters
# pass this function and the set of arguments to the plmapp function
# plmapp will take care of paral... |
test_wsgi.py | from __future__ import absolute_import
import sys
import time
import threading
from wsgiref.simple_server import make_server
try:
from urllib2 import urlopen
except ImportError:
from urllib.request import urlopen # py3
from ufork import Arbiter
from .utils import check_leaked_workers
SERVER_HOST = "0.0.0.0... |
camera.py | import threading
import binascii
from time import sleep
from utils import *
############################################################################
import base64
import io
from PIL import Image
def img_to_txt(filename):
msg = b"<plain_txt_msg:img>"
with open(filename, "rb") as ima... |
main.py | #!/usr/bin/env python3
import pychromecast
import socket
import http.server
import socketserver
import threading
from gtts import gTTS
def local_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
address = s.getsockname()[0]
s.close()
return address
def creat... |
flood.py | from threading import Thread, Event
from _bots import *
from sys import argv
from contextlib import suppress
q = queue.Queue()
e = Event()
e.set()
def check_code(pin):
epoch = int(datetime.datetime.now().timestamp())
r = requests.get(f'https://kahoot.it/reserve/session/{pin}/?{epoch}')
if r.status_code != ... |
tests.py | # -*- coding: utf-8 -*-
# Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
from __future__ import unicode_literals
import os
import re
import copy
import shutil
import tempfile
import threading
import time
import unittest
import warnings
from django.conf import settings
... |
serve.py | # Copyright 2021 Cortex Labs, 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... |
session_server.py | #!/usr/bin/env python
# Copyright 1996-2019 Cyberbotics 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-2.0
#
# Unless required by applica... |
mpyg321.py | import pexpect
import sys
from threading import Thread
from pexpect import exceptions
import time
mpg_outs = [
{
"mpg_code": "@P 0",
"action": "music_stop",
"description": """For mpg123, it corresponds to any stop
For mpg312 it corresponds to user stop only"""
}... |
moving_topology_fts.py | from fts_base import FTSBaseTest, FTSException
from fts_base import NodeHelper
from TestInput import TestInputSingleton
from threading import Thread
from lib.remote.remote_util import RemoteMachineShellConnection
from lib.memcached.helper.data_helper import MemcachedClientHelper
from lib.membase.api.rest_client import ... |
test_datalist_combined_threads.py | import time
import argparse
import numpy as np
from sklearn.metrics import confusion_matrix
import cv2
from models import TSN
from transforms import *
from ops import ConsensusModule
import pycuda.driver as cuda
from PIL import Image
from streaming import streaming
from threading import Thread, Event
from queue im... |
drone.py | import math
import threading
import time
import cv2
from djitellopy import tello as drone
class Drone:
is_flying = False
def __init__(self, mock: bool):
self.sdk = drone.Tello()
self.drone_locator = DroneLocator()
self.drone_locator.watch()
self.mock = mock
self.video_stream = self.start_stream()
def ... |
test_local_task_job.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
#... |
index.py | """Routines related to PyPI, indexes"""
import sys
import os
import re
import gzip
import mimetypes
import threading
import posixpath
import pkg_resources
import random
import socket
import string
import zlib
from pip.log import logger
from pip.util import Inf
from pip.util import normalize_name, splitext
from pip.exc... |
detector_utils.py | # Utilities for object detector.
import numpy as np
import sys
import tensorflow as tf
import os
from threading import Thread
from datetime import datetime
import cv2
from utils import label_map_util
from collections import defaultdict
detection_graph = tf.Graph()
sys.path.append("..")
# score threshold for showing ... |
scheduler.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
USAGE = """
## Example
For any existing app
Create File: app/models/scheduler.py ======
from gluon.scheduler import Scheduler
def demo1(*args,**vars):
print 'you passed args=%s and vars=%s' % (args, vars)
return 'done!'
def demo2():
1/0
scheduler = Schedul... |
rc_driver.py | __author__ = 'Quadrifrons'
import threading
import SocketServer
import socket
#import serial
import cv2
import numpy as np
import math
# distance data measured by ultrasonic sensor
sensor_data = " "
host=''
class NeuralNetwork(object):
def __init__(self):
self.model = cv2.ANN_MLP()
def create(self)... |
main.py | import time
import threading
from tkinter import *
class EyeRelax:
"""主要类"""
log_line = "========================"
def __init__(self):
self.root = Tk()
self.lb_wkt = Label(master=self.root)
self.lb_rlt = Label(master=self.root)
self.ety_wkt = Entry(master=self.root)
... |
asyncio_dispatcher.py | import asyncio
import inspect
import logging
import threading
import atexit
class AsyncioDispatcher:
def __init__(self, loop=None):
"""A dispatcher for `asyncio` based IOCs, suitable to be passed to
`softioc.iocInit`. Means that `on_update` callback functions can be
async. If loop is None, ... |
Main.py | import pandas as pd
from Client import clientclass
from Server import serverclass
from Stats import *
from LTE import *
from NodeDiscovery import *
from policy import *
from dynamic_plot import *
from user import *
from multiprocessing import Process
import multiprocessing
import os.path
import os
import shutil as sh
... |
search.py | import time
import threading
import xbmcgui
import kodigui
import opener
import windowutils
from lib import util
from lib.kodijsonrpc import rpc
from plexnet import plexapp
class SearchDialog(kodigui.BaseDialog, windowutils.UtilMixin):
xmlFile = 'script-plex-search.xml'
path = util.ADDON.getAddonInfo('path... |
test_client_cli.py | import json
import pytest
import os
import time
import socket
import threading
from client_cli import Wallet, Transaction, run
PASSPHRASE = "123456"
CRO = 10**8
ZEMU_HOST = "127.0.0.1"
ZEMU_BUTTON_PORT = 9997
os.environ["ZEMU_HTTP_HOST"] = ZEMU_HOST
os.environ["ZEMU_HTTP_PORT"] = "9998"
class PressButton:
def _... |
installwizard.py | # Copyright (C) 2018 The Electrum developers
# Distributed under the MIT software license, see the accompanying
# file LICENCE or http://www.opensource.org/licenses/mit-license.php
import os
import sys
import threading
import traceback
from typing import Tuple, List, Callable, NamedTuple, Optional
from PyQt5.QtCore i... |
batch_env_factory.py | # coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.