source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
locusts.py | import io
import multiprocessing
import os
import sys
from httprunner.logger import color_print
from httprunner.testcase import load_test_file
from locust.main import main
def parse_locustfile(file_path):
""" parse testcase file and return locustfile path.
if file_path is a Python file, assume it is a l... |
test_user_secrets.py | import json
import os
import subprocess
import threading
import unittest
from http.server import BaseHTTPRequestHandler, HTTPServer
from test.support import EnvironmentVarGuard
from urllib.parse import urlparse
from datetime import datetime, timedelta
import mock
from google.auth.exceptions import DefaultCredentialsEr... |
test_basic.py | import pytest
import time
import threading
WINDOWS_DATA = {
"signal": None,
"stacktraces": [
{
"registers": {"eip": "0x0000000001509530"},
"frames": [{"instruction_addr": "0x749e8630"}],
}
],
"modules": [
{
"type": "pe",
"debug_id"... |
controller.py | import re
import re
import shutil
import time
import traceback
from subprocess import Popen, STDOUT
from threading import Thread
from typing import List, Set, Type, Tuple, Dict
from waffles.api.abstract.controller import SoftwareManager, SearchResult, ApplicationContext, UpgradeRequirements, \
UpgradeRequirement, ... |
sphinx_.py | """Interface with Sphinx."""
import datetime
import logging
import multiprocessing
import os
import sys
from shutil import copyfile, rmtree
from sphinx import application, locale
from sphinx.cmd.build import build_main, make_main
from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.config import Config ... |
chat_server.py | """
Author: Levi
Email: lvze@tedu.cn
Time : 2020-12-15
Env : Python3.6
socket and process exercise
"""
from socket import *
from multiprocessing import Process
# 服务器地址
HOST = "0.0.0.0"
PORT = 8888
ADDR = (HOST, PORT)
# 存储用户信息的结构 {name:address}
user = {}
def do_login(sock, name, address):
if name in user or "管理... |
load_testing.py | import requests
import threading
import datetime
def req():
for i in range(40):
pload = {"input": "def foo():\n\tprint()", "in_lang": "py", "out_lang": "js"}
url = 'https://cjsback.herokuapp.com/'
r = requests.post(url, data = pload)
print(r.json())
threads = []
begin_time = 0
for... |
main.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2019/1/14 4:35 PM
# @Author : w8ay
# @File : main.py
import os
import sys
import threading
import time
from config import THREAD_NUM, DEBUG, NODE_NAME
from lib.data import PATHS, logger
from lib.engine import Schedular
from lib.redis import redis_con
from... |
main.py | from pynput.keyboard import Key, Listener
import sys
import os
import time
from threading import Thread
import json
save_file = "spc-clicker.sav"
space_counter = 0
bot_number = 0
bot_price = 10
click_multi_number = 0
click_multi_price = 100
# Load from the save file
if os.path.exists(save_file):
with open(save... |
UDPNode.py | #!/usr/bin/env python3
import sys
import struct
import socket
import queue
import threading
import utility
import time
# Message types
PKT_TYPE_UPDATE = 1
PKT_TYPE_KEEP_ALIVE = 2
PKT_TYPE_ACK_KEEP_ALIVE = 3
PKT_TYPE_FLOOD = 4
PKT_TYPE_DATA_MSG = 5
PKT_TYPE_COST_CHANGE = 6
PKT_TYPE_DEAD ... |
app.py | import socket
import subprocess
import os
import pwd
import pdb
import sys
import traceback
from threading import Thread
from library import get_username
from client_thread import client_threading
sockfd=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sockfd.bind(('',12348))
sockfd.listen(4)
print("My ec... |
test_qt_notifications.py | import threading
import warnings
from concurrent.futures import Future
from unittest.mock import patch
import dask.array as da
import pytest
from qtpy.QtCore import Qt, QThread
from qtpy.QtWidgets import QPushButton
from napari._qt.dialogs.qt_notification import NapariQtNotification
from napari._tests.utils import DE... |
scan.py | #!/usr/bin/env python
# encoding=utf-8
#codeby 道长且阻
#email ydhcui@suliu.net/QQ664284092
import socket
import re
import os
import time
import json
import urllib
import threading
import datetime
import copy
import queue
from lib import requests
from lib.dns.resolver import Resolver
from core.websearch import B... |
store.py | import datetime
import json
import threading
import uuid
from collections import defaultdict
from copy import deepcopy
from dictdiffer import diff
from inspect import signature
from threading import Lock
from pathlib import Path
from tzlocal import get_localzone
from .logger import logger
from .settings import CACHE_... |
__main__.py | import sys
import multiprocessing as mp
import importlib.resources
import signal
from pystray import Icon, Menu, MenuItem
import click
from . import FatalError, run_server, PORT, server_process, \
viewer, warning, local_storage, shutdown_server, load_png_logo
from .viewer import ViewerSettings
WEBVIEW_PROCESSE... |
test_mp_full.py | """
multiproc full tests.
"""
import importlib
import multiprocessing
import platform
import pytest
import time
import wandb
from wandb.errors import UsageError
import sys
def train(add_val):
time.sleep(1)
wandb.log(dict(mystep=1, val=2 + add_val))
wandb.log(dict(mystep=2, val=8 + add_val))
wandb.log... |
test_tracer.py | import time
import opentracing
from opentracing import (
child_of,
Format,
InvalidCarrierException,
UnsupportedFormatException,
SpanContextCorruptedException,
)
import ddtrace
from ddtrace.ext.priority import AUTO_KEEP
from ddtrace.opentracer import Tracer, set_global_tracer
from ddtrace.opentrace... |
basic_sensor.py | """
Basic Sensor that will adhere to robot at end of end effector
Functionality:
- Placeholder sensor
- Will read position of where robot is in global frame (has knowledge of what robot connected to)
- Initially publishing sensor data, can be turned off/on via sensor/ID/state topic
Future features:
- Real sensor simul... |
eval_branch_pairs_synapses.py | import os
import sys
import glob
import multiprocessing as mp
import numpy as np
import matplotlib.pyplot as plt
import util
import util_feature_IO
def printUsageAndExit():
print("eval_branch_pairs_synapses.py network-dir mode num-workers")
print()
print("mode: aggregate, plot")
exit()
def getF... |
txnTest.py | #!/usr/bin/env python2
import sys, pdb
import bitcoin
import bitcoin.rpc
import bitcoin.core
import bitcoin.wallet
import time
import types
import datetime
from decimal import *
import httplib
import socket
import random
import threading
#bitcoin.SelectParams('testnet')
bitcoin.SelectParams('regtest')
BTC = 100000000... |
doudizhu_random_multi_process.py | import time
import multiprocessing
import rlcard3
from rlcard3.agents.random_agent import RandomAgent
from rlcard3.utils.utils import set_global_seed, assign_task
if __name__ == '__main__':
# Timer start
start = time.time()
# Avoid RuntimeError
multiprocessing.freeze_support()
# Set the number o... |
emailb0mb3r.py | #!/usr/bin/python
# this python script sends multiple messages to a target.
import getpass
import smtplib
from email.message import EmailMessage
import threading
import random
import time
import colorama
import sys
from colorama import Style
from colorama import Fore
colorama.init()
err = (Fore.RED+Sty... |
resnet50_waa.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... |
test_client.py | #!/usr/bin/env python
# Copyright 2012 James McCauley
#
# 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... |
client_socket.py | """
client_socket.py:
Socket used to attach to the TCP server as a client and read/write data.
"""
import select
import socket
import threading
from fprime.constants import DATA_ENCODING
from fprime_gds.common.handlers import DataHandler
# Constants for public use
GUI_TAG = "GUI"
FSW_TAG = "FSW"
class ThreadedTCP... |
cbas_secondary_indexes.py | from cbas_base import *
# from couchbase import FMT_BYTES
import threading
import random
class CBASSecondaryIndexes(CBASBaseTest):
def setUp(self):
self.input = TestInputSingleton.input
if "default_bucket" not in self.input.test_params:
self.input.test_params.update({"default_bucket": ... |
MultiWorker.py | import multiprocessing as mp
import typing as t
from threading import Thread
from typeguard import typechecked
class MultiWorker:
_sentinel = None
_finished_adding = False
@typechecked
def __init__(
self,
job: t.Callable[..., t.Any],
init: t.Callable[..., t.Any] = None,
... |
controller.py | import sys
import os
sys.path.append('scripts/')
from arduino_comms import Database, Monitor
from comms_emulate import EmuSystem
import configparser
from time import strftime, localtime, sleep
import threading
import pickle
import ast
class aeroD:
def __init__(self, interval=8):
self.interval = interval
... |
test_integration.py | from __future__ import absolute_import, division, print_function
import sys
from threading import Thread, Lock
import json
import warnings
import time
import stripe
import pytest
if sys.version_info[0] < 3:
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
else:
from http.server import BaseHTTPRe... |
mips.py | # Preprocessor for MIPS assignments
from multiprocessing import Process
import helpers.common as common
import re
def processToken(token):
# are we a directive
directives = [".data", ".text", ".kdata", ".ktext", ".set", ".ascii", ".asciiz", ".byte", ".halfword", ".word", ".space", ".align", ".double", ".extern... |
downloader.py | import logging
import os
import threading
import requests
import cfg
from .app_constants import *
class Downloader:
"""
Description: Downloader class contains methods which collectively work together to download image resources \
from urls and save them into user specified system path. As p... |
pykms_GuiMisc.py | #!/usr/bin/env python3
import os
import re
import sys
from collections import Counter
from time import sleep
import threading
import tkinter as tk
from tkinter import ttk
import tkinter.font as tkFont
from pykms_Format import MsgMap, unshell_message, unformat_message
#------------------------------------------------... |
hello_world__Process.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from multiprocessing import Process
def f(name):
print('Hello,', name)
if __name__ == '__main__':
p = Process(target=f, args=('bob',))
p.start()
p.join()
|
test_shm.py | import pytest
import time
import numpy as np
import torch
from multiprocessing import Process
from ding.envs.env_manager.subprocess_env_manager import ShmBuffer
def writer(shm):
while True:
shm.fill(np.random.random(size=(4, 84, 84)).astype(np.float32))
time.sleep(1)
@pytest.mark.unittest
def t... |
keep_alive.py | # file name is keep_alive.py
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def main():
return "Your bot is alive!"
def run():
app.run(host="0.0.0.0", port=8080)
def keep_alive():
server = Thread(target=run)
server.start() |
ping.py | #!/usr/bin/env python3
# -*- coding: UTF=8 -*-
import ipaddress
import threading
from queue import Queue
from scapy.all import IP, ICMP, sr1, getmacbyip
try:
from method.sub.ipget import cidr_ip
except ImportError:
from sub.ipget import cidr_ip
class Ping:
"""A class to recieve IPs of host ... |
test.py | from contextlib import contextmanager
from ctypes import cdll
from ctypes.util import find_library
import datetime
import functools
import hashlib
import hmac
import os
import socket
import sqlite3
import tempfile
import threading
import unittest
import urllib.parse
import uuid
import httpx
from sqlite_s3_query impor... |
web.py | from flask import Flask,request
from requests import get,post
import threading
import os
from main import start_bot
status =""
app = Flask(__name__)
SITE_NAME = 'http://127.0.0.1:8080/'
@app.route('/jsonrpc',methods=['POST'])
def proxypost():
path="jsonrpc"
#print("post")
#print(f'{SITE_NAME}{path}')
u... |
lambda_executors.py | import os
import re
import json
import time
import logging
import threading
import subprocess
# from datetime import datetime
from multiprocessing import Process, Queue
try:
from shlex import quote as cmd_quote
except ImportError:
# for Python 2.7
from pipes import quote as cmd_quote
from localstack import ... |
Chap10_Example10.22.py | from threading import *
def mymsgprint():
mychildthread2 = Thread(target=disp2) # DL2
print("Second Child thread name is", mychildthread2.getName(), end='')
if mychildthread2.daemon:
print(" and is a daemon thread and it's parent name is", mychildt1.getName())
else:
print(" a... |
processor.py | import os
import re
import subprocess
import sys
from functools import partial
from threading import Thread
from gooey.gui import events
from gooey.gui.pubsub import pub
from gooey.gui.util.casting import safe_float
from gooey.gui.util.taskkill import taskkill
from gooey.util.functional import unit, bind
... |
box_rpc.py | import copy
import datetime
import socket
import subprocess
import threading
import time
try:
from queue import Queue
except ImportError:
from Queue import Queue
import plumbum
import rpyc
from sqlalchemy import sql
from zeroconf import ServiceBrowser, Zeroconf
import config
from web import db_schema
from co... |
test_socket.py | import unittest
from test import support
import errno
import io
import itertools
import socket
import select
import tempfile
import time
import traceback
import queue
import sys
import os
import array
import platform
import contextlib
from weakref import proxy
import signal
import math
import pickle
import struct
impo... |
file_server.py | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
FaceDetection.py | import time
import cv2
import numpy as np
import os, sys
import pickle
import nep
import threading
import sharo
show_image = 1
try:
print (sys.argv[1])
show_image = int(sys.argv[1])
print ("Show image: " + show_image)
except:
pass
node = nep.node('face_detection')
sub_image = node.new_sub('robot_image... |
data_processing.py | # -*- coding: utf-8 -*-
import numpy as np
import re
import random
import json
import collections
import numpy as np
import util.parameters as params
from tqdm import tqdm
import nltk
from nltk.corpus import wordnet as wn
import os
from util.data_annotation import POS_dict_spacy, PADDING
import pickle
import multiproc... |
DashboardServiceServer.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... |
bot.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from sending_schelude import job_sending
from longpool import job_longpool
from threading import Thread
print('Бот запущен...')
th_1 = Thread(target = job_longpool)
th_2 = Thread(target = job_sending)
# функция запуска многопоточной работы бота
if __name__ == '__main__':
... |
kombu_server.py | # Copyright 2015 - Mirantis, 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 agree... |
srxdbepinexinstallerui.pyw | from tkinter import *
from tkinter import messagebox
from tkinter.filedialog import askdirectory
from tkinter import ttk
import threading
import sys
from os import path
from modules.gui import GuiUtils, PrintLogger
from modules.steamutils import SteamUtils
from modules.github import GitHubUtils
from modules.installer... |
main.py | import os
import json
import urllib.request
import zipfile
import io
import sys
import gzip
import platform
import time
import threading
import subprocess
import secrets
from config import PORT, TLS_DOMAIN, AUTHTOKEN
from http.server import HTTPServer, BaseHTTPRequestHandler
class GETHandler(BaseHTTPRequestHandler):
... |
TCController.py | import logging
import os
import threading
import time
from Utility.util import get_current_unix
from TrafficController.BWEstimator import BWEstimator
LOGGING_LEVEL = logging.INFO
handler = logging.StreamHandler()
handler.setLevel(LOGGING_LEVEL)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s -... |
Synchronize_3_Robots.py | # Type help("robolink") or help("robodk") for more information
# Press F5 to run the script
# Documentation: https://robodk.com/doc/en/RoboDK-API.html
# Reference: https://robodk.com/doc/en/PythonAPI/index.html
#
# This example shows to synchronize multiple robots at the same time
from robodk.robolink import * # ... |
audio_reader.py | import fnmatch
import os
import random
import re
import threading
import librosa
import numpy as np
import tensorflow as tf
FILE_PATTERN = r'p([0-9]+)_([0-9]+)\.wav'
def get_category_cardinality(files):
id_reg_expression = re.compile(FILE_PATTERN)
min_id = None
max_id = None
for filename in files:
... |
framework.py | #!/usr/bin/env python
from __future__ import print_function
import gc
import sys
import os
import select
import unittest
import tempfile
import time
import resource
import faulthandler
import random
from collections import deque
from threading import Thread, Event
from inspect import getdoc, isclass
from traceback imp... |
tests.py | # -*- coding: utf-8; -*-
#
# Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License"... |
web_server_4.py | #!/usr/bin/python3
# file: multiprocess_web_server.py
# Created by Guang at 19-7-19
# description:
# *-* coding:utf8 *-*
import multiprocessing
import socket
import re
import time
import sys
sys.path.insert(0, "../../")
from mini_web.framework import mini_frame_4
class WSGIServer(object):
def __init__(self, i... |
test_utils.py | # Copyright BigchainDB GmbH and BigchainDB contributors
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
import queue
from unittest.mock import patch, call
import pytest
@pytest.fixture
def mock_queue(monkeypatch):
class MockQueue:
items = []
de... |
_app.py | """
websocket - WebSocket client library for Python
Copyright (C) 2010 Hiroki Ohtani(liris)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, ... |
lisp-core.py | # -----------------------------------------------------------------------------
#
# Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com>
#
# 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... |
train_pg_3.py | #Reference:
#1. https://github.com/mabirck/CS294-DeepRL/blob/master/lectures/class-5/REINFORCE.py
#2. https://github.com/JamesChuanggg/pytorch-REINFORCE/blob/master/reinforce_continuous.py
#3. https://github.com/pytorch/examples/blob/master/reinforcement_learning/actor_critic.py
# With the help from the implementation... |
scheduler.py | import logging
import os
import signal
import time
import traceback
from datetime import datetime
from multiprocessing import Process
from .job import Job
from .queue import Queue
from .registry import ScheduledJobRegistry
from .utils import current_timestamp, enum
from .logutils import setup_loghandlers
from redis ... |
program.py | """
TODO: Preserve stderr
- https://stackoverflow.com/questions/31833897/python-read-from-subprocess-stdout-and-stderr-separately-while-preserving-order
- https://stackoverflow.com/questions/12270645/can-you-make-a-python-subprocess-output-stdout-and-stderr-as-usual-but-also-cap
"""
import io
import logging
import sy... |
parallel.py | from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import operator
import sys
from threading import Semaphore
from threading import Thread
from docker.errors import APIError
from six.moves import _thread as thread
from six.moves.queue import Empty
from six.moves.queue import... |
HiwinRA605_socket_ros_test_20190626113918.py | #!/usr/bin/env python3
# license removed for brevity
#接收策略端命令 用Socket傳輸至控制端電腦
import socket
##多執行序
import threading
import time
##
import sys
import os
import numpy as np
import rospy
import matplotlib as plot
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import HiwinRA605_s... |
thread_event.py | import threading
from time import sleep
"""
threading.Event: 'wait' for the same Event run 'set' function
threading.Thread: 'join' will blocking till the thread operation ending
"""
def test(n, event):
print('Thread %s is ready' % n)
event.wait()
print('Thread %s is running' % n)
def mai... |
worker.py | # -*- coding: utf-8 -*-
import abc
import multiprocessing
import logging
import random
import threading
import time
from tinyq.exceptions import JobFailedError
from tinyq.job import Job
logger = logging.getLogger(__name__)
class BaseWorker(metaclass=abc.ABCMeta):
@abc.abstractmethod
def run_once(self):
... |
util.py | import sys
import time
from math import ceil
import threading
class ProgressBar():
def __init__(self, bar_length=40, slug='#', space='-', countdown=True):
self.bar_length = bar_length
self.slug = slug
self.space = space
self.countdown = countdown
self.start_time = None
... |
pre_inject_for_ycsb.py | import sys
import redis
import random
import threading
# [start, end)
def thread_func(r: redis.StrictRedis, start, end):
for i in range(start, end):
key = "key_" + str(i)
val = "val_" + str(random.randint(0,9)) * random.randint(20, 2000)
r.set(name=key, value=val)
def _main():
if len... |
arduino.py | import threading
import serial
import const
from helpers import d
s = None
stop_threads = False
def init_serial():
global s
s = serial.Serial(const.ARDUINO_PORT, const.ARDUINO_BAUDRATE, timeout=const.ARDUINO_TIMEOUT)
def set_default_value(key, val):
if key == 'COLOR_RED':
const.CURRENT_COLOR[0... |
MMA8451ToMSeed.py | #!/usr/bin/python3
# Simple demo of fifo mode on the MMA8451.
# Author: Philip Crotwell
import time
import json
import struct
import queue
from threading import Thread
from datetime import datetime, timedelta, timezone
import sys, os, signal
import socket
from pathlib import Path
import asyncio
import traceback
import... |
threading_event.py | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
import threading
import time
event = threading.Event()
def trafficlight():
count = 0
while True:
if count < 5:
event.set()
print('=======green========')
elif count >= 5 and count < 10:
event.clear()
... |
rbssh.py | #!/usr/bin/env python
#
# rbssh.py -- A custom SSH client for use in Review Board.
#
# This is used as an ssh replacement that can be used across platforms with
# a custom .ssh directory. OpenSSH doesn't respect $HOME, instead reading
# /etc/passwd directly, which causes problems for us. Using rbssh, we can
# work arou... |
test_sync_clients.py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import py... |
weixin.py | #!/usr/bin/env python
# coding: utf-8
import qrcode
from pyqrcode import QRCode
import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
import http.cookiejar
import requests
import xml.dom.minidom
import json
import time
import datetime
import ssl
import re
import sys
import ... |
test_filesink_compression.py | import datetime
import os
import sys
import threading
import time
import pytest
import loguru
from loguru import logger
@pytest.mark.parametrize(
"compression", ["gz", "bz2", "zip", "xz", "lzma", "tar", "tar.gz", "tar.bz2", "tar.xz"]
)
def test_compression_ext(tmpdir, compression):
i = logger.add(str(tmpdir... |
click_count.py | from pynput import mouse
import wx
import time
import threading
class Singleton:
_unique_instance = None
elapsed_time = 0
click_count = -1
active_state = False
@classmethod
def get_instance(cls):
if not cls._unique_instance:
cls._unique_instance = cls()
... |
p_bfgs.py | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
main.py | # python main.py \ --train_data=input.txt \ --eval_data=hrv_questions.txt \ --save_path=hrv_tmp/
import os
import sys
import threading
import time
import numpy as np
import tensorflow as tf
from tensorflow.models.embedding import gen_word2vec as word2vec
flags = tf.app.flags
flags.DEFINE_string... |
mixed_compare.py | import logging
import multiprocessing
from multiprocessing.pool import ThreadPool
import threading
import time
logging.basicConfig()
logger = logging.getLogger("mixed_task_campare")
logger.setLevel(logging.DEBUG)
LOOP = 5000
NUM = 50000
elapsed_time = {}
def count(n):
while n > 0:
n = n - 1
time.sle... |
main.py | import threading
import sys
from flask import Flask, abort, request
from flask_limiter import Limiter
from yowsup.config.manager import ConfigManager
from yowsup.profile.profile import YowProfile
import sendclient
# Start yowsup thread
config = ConfigManager().load(sys.argv[1])
profile = YowProfile(config.phone, co... |
hfut_img.py | # -*- coding:utf-8 -*-
"""
抓取全校学生的照片
"""
from __future__ import unicode_literals
import logging
import os
import sys
import threading
import requests
import six
from hfut import Guest, XC, HF
from hfut.util import cal_term_code
# 文件保存路径
DIR_NAME = 'img'
# 起始年份
START_YEAR = 2012
# 结束年份
END_YEAR = 2015
# 校区
campus =... |
HiwinRA605_socket_ros_test_20190625190318.py | #!/usr/bin/env python3
# license removed for brevity
#接收策略端命令 用Socket傳輸至控制端電腦
import socket
##多執行序
import threading
import time
##
import sys
import os
import numpy as np
import rospy
import matplotlib as plot
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import HiwinRA605_s... |
osc_server.py | """OSC Servers that receive UDP packets and invoke handlers accordingly.
Use like this:
dispatcher = dispatcher.Dispatcher()
# This will print all parameters to stdout.
dispatcher.map("/bpm", print)
server = ForkingOSCUDPServer((ip, port), dispatcher)
server.serve_forever()
or run the server on its own thread:
serve... |
article_extractor2.py | import subprocess
from multiprocessing import Queue, Process, Value
import json
import psycopg2
from io import StringIO
from html.parser import HTMLParser
class MLStripper(HTMLParser):
def __init__(self):
super().__init__()
self.reset()
self.strict = False
self.convert_charrefs= Tru... |
server.py | from http.server import BaseHTTPRequestHandler, HTTPServer
import re
import numpy as np
from urllib.parse import urlparse
from urllib.parse import parse_qs
from multiprocessing import Process
import multiprocessing
# from fuzzywuzzy import fuzz
# from fuzzywuzzy import process
from rapidfuzz import process
from rapi... |
handler.py | from abc import ABC
from datetime import datetime
import json
import os
import shutil
import log
import threading
import urllib
import re
import glob
import settings
from scripts import util
from webdriver.webdriver_connection import WebDriverConnection
from database.database_connection import DatabaseConnection
fr... |
Broadlink-RM3-MQTTBridge.py | #!/usr/bin/python
#
# I've taken Perrin7's NinjaCape MQTT Bridge code and modified it for the
# Broadlink RM3 and the Blackbean python code.
#
# This retains Perrin7's MIT License
# 1) Read the ini file using configparser
# a) get the Blackbean information
# i) host
# ii) port
# iii) mac
# ... |
_gnupg.py | # Copyright (c) 2008-2014 by Vinay Sajip.
# 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 cond... |
process-manager.py | ###
# Multiprocessing manager test.
#
# License - MIT.
###
import os
from multiprocessing import Process, Manager, Lock
# process_function - Process test function.
def process_function(pLock, pDict):
# {
with pLock:
pDict['num'] -= 1
# }
# Main function.
def main():
# {
lock = Lock()
with Mana... |
wtf.py | #***Essential Data and Imports (Do not modify, except USE_SPARK)
#DEFINE USE_SPARK
USE_SPARK = True
try:
from pyspark import SparkConf, SparkContext
except ImportError as e:
if USE_SPARK:
raise e
from datetime import datetime
import sys
class MasterURL():
test = "spark://143.106.73.43:7077"
prod... |
wsgi_server.py | #!/usr/bin/env python
#
# Copyright 2007 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 o... |
fmos_mastercode_bonsai.py | '''
FMOS MASTERCODE - Freely Moving Olfactory Search Mastercode
Written: Teresa Findley, tmfindley15@gmail.com
Last Updated: 10.27.2020 (Dorian Yeh)
--Records tracking data via OSC communication with custom code in Bonsai (open source computer vision software -- https://bonsai-rx.org/)
--Records signal data t... |
mainwindow.py | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Spyder, the Scientific Python Development Environment
=====================================================
Developped and maintained by the Spyder Pro... |
pipe.py | from multiprocessing import Process,Queue
import time
import random
def xiaofei(q):
while 1:
x = q.get()#取出队列中的内容
time.sleep(random.randrange(0, 11, 2))
if x:#判断取出的额内容是不是空,不是空打印
print("处理"+x)
else:#取出的内容是空,直接退出循环
break
def shengchan(q):
for i i... |
core.py | #!/usr/bin/env python
import math
import cv2
import numpy as np
import rospy
from std_msgs.msg import String
from self_driving_turtlebot3.msg import Traffic_light
from sensor_msgs.msg import CompressedImage
from sensor_msgs.msg import Image
from std_msgs.msg import Float32MultiArray
from self_driving_turtlebot3.msg imp... |
game_controller.py | import json
import queue
try:
from GUI import GUI
from camelot_error import CamelotError
from camelot_error_manager import CamelotErrorManager
from platform_IO_communication import PlatformIOCommunication
from camelot_action import CamelotAction
from camelot_world_state import CamelotWorldState
... |
settings_20210906110948.py | """
Django settings for First_Wish project.
Generated by 'django-admin startproject' using Django 3.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathli... |
test.py | import threading, time
def nothing():
time.sleep(10)
t=threading.Thread(target=nothing)
t.start()
name=t.name
for i in range(100):
unfinished_thread_names = [t.name for t in threading.enumerate() if t.name in {name: 'nothing'}.keys()]
status = [tdescr for tname, tdescr in {name: 'nothing'}.items() if t... |
3_threading.py | import threading
import time
a = 3
def func1(x,queque):
time.sleep(1)
print 'a :' + str(a)
queque[x] =5
return x*x
if __name__ == '__main__':
dict = dict()
t1 = threading.Thread(target=func1, args=(1,dict,))
t2 = threading.Thread(target=func1, args=(2,dict,))
t1.start()
t2.star... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.