source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
test_hass_state.py | import json
import time
import warnings
from threading import Thread, Event
import asyncio
import pytest
import websockets
import pnp.plugins.pull.hass as hass
from . import start_runner, make_runner
def wait_for_event(evt):
for _ in range(10):
if evt.is_set():
break
time.sleep(0.25... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from cereal import log
from common.realtime import sec_since_boot
from common.params import Params, put_nonblocking
from common.hardware import TICI
from selfdrive.swaglog import cloudlog
PANDA_OUTPUT_VOLTAGE = 5.28
CAR_VOLTAGE_LOW_PASS_K = 0.091 ... |
data_to_tfrecord_multithread.py | ################################################################################################
# 离线任务运行要做的准备工作
import os
# 相关包的安装
# f = os.popen('python -m pip install --upgrade pip')
# print(f.readlines())
# f = os.popen('pip install tensorflow-datasets==3.2.1')
# print(f.readlines())
# f = os.popen('pip insta... |
map_reduce.py | # -*- coding: utf-8 -*-
r"""
Parallel computations using RecursivelyEnumeratedSet and Map-Reduce
There is an efficient way to distribute computations on a set
`S` of objects defined by :func:`RecursivelyEnumeratedSet`
(see :mod:`sage.sets.recursively_enumerated_set` for more details)
over which one would like to perfo... |
dataloader_iter.py | # Copyright (c) 2020 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... |
test_explicit_comms.py | import asyncio
import multiprocessing as mp
import numpy as np
import pandas as pd
import pytest
import dask
from dask import dataframe as dd
from dask.dataframe.shuffle import partitioning_index
from distributed import Client, get_worker
from distributed.deploy.local import LocalCluster
import dask_cuda
from dask_c... |
wait_rabbitmq.py | import sys
import json
import time
import pika
import queue
import pickle
import logging
from threading import Thread
from concurrent.futures import ThreadPoolExecutor, wait
logger = logging.getLogger(__name__)
logging.getLogger('pika').setLevel(logging.WARNING)
ALL_COMPLETED = 1
ANY_COMPLETED = 2
ALWAYS = 3
def wa... |
HiwinRA605_socket_ros_20190614132043.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... |
test_subprocess.py | import unittest
from test import test_support
import subprocess
import sys
import signal
import os
import errno
import tempfile
import time
import re
import sysconfig
try:
import resource
except ImportError:
resource = None
try:
import threading
except ImportError:
threading = None
mswindows = (sys.pl... |
IRC.py | #!/usr/bin/python3
import socket , re , datetime , threading , time
#IRC Information
SERVER = 'irc.freenode.net'
PORT = 6667
NICKNAME = 'write nickname here'
CHANNEL = '#write channel here'
network = SERVER.split('.')
#Terminal Colours
Black = '\x1b[30m'
Red = '\x1b[31m'
Green = '\x1b[32m'
Yellow = '\x1b[33m... |
test_graph.py | """
Copyright 2020 The OneFlow 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 applicable law or agr... |
pifbot.py | #!/usr/local/bin/python3
# coding: utf-8
#
# File = pifbot.py
#
# Copyright 2019 Rob Curtis
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... |
Navigator_rrtstar.py | #encoding=utf-8
'''
project overview:
Subscribe:
1.slam pose(global/local pose) *
2.octomap_server/global map
3.local pointcloud/local octomap
4.target input(semantic target/visual pose target/gps target)
Publish:
1.Mavros(amo) Command
2.Navigator status
Algorithms:
1.D*
2.state transfer
... |
socket_adapter.py | import remotefile
import socket
import numheader
import threading
import sys
@remotefile.TransmitHandler.register
class TcpSocketAdapter:
"""
Remotefile TCP socket adapter
"""
def __init__(self):
self.isConnected=False
self.isAlive=False
self.receiveHandler=None #a receiveHa... |
run_pitchlines.py | # -*- coding: utf-8 -*-
from rasp_audio_stream import AudioInputStream
from pqg_pitchlines import PQGPitchLines
# PyAudioストリーム入力取得クラス
ais = AudioInputStream(CHUNK=4096) #, input_device_keyword="Real")
# メルスペクトログラム用クラス
pitchlines = PQGPitchLines( ais.RATE, (ais.CHANNELS, ais.CHUNK) )
# AudioInputStreamは別スレッドで動かす
impo... |
thread.py | import threading
def printCube(num):
print("Cube: {}\n".format(num*num*num))
def printSquare(num):
print("Square: {}\n".format(num * num))
if __name__ == "__main__":
# creating thread
t1 = threading.Thread(target=printSquare, args=(10,))
t2 = threading.Thread(target=printCube, args=(10,))
# ... |
thread.py | """Threading utilities."""
import time
import threading
from .timing import TimeoutException
def execute_as_thread(
target,
args=None,
kwargs=None,
daemon=False,
join=True,
break_join=None,
join_sleep=0.01,
timeout=None,
):
"""
Execute target callable in a separate thread.
... |
context.py | # Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016,2017
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
try:
from future import standard_library
standard_library.install_aliases()
except (ImportEr... |
AddSquaresMultiThreading.py | import time, os
import threading as th
import multiprocessing as mp
NUMBERLIST = [2354, 9743, 2856, 1928, 4345, 3421]
def square_number(idx, number, results):
pid = os.getpid()
threadName = th.current_thread().name
processName = mp.current_process().name
#Print Starting Statement
print(f"{pid} ... |
__init__.py | from __future__ import print_function, division, absolute_import
import os
import sys
import shutil
import subprocess
import optparse
import math
import signal
import threading
import atexit
import imp
import re
import pprint
import time
import traceback
import locale
try:
import Queue as queue
except ImportError... |
recorder.py | # append for auto_profiling
import sys, os
from mxnet import profiler
import json
import networkx as nx
import threading
import time
import struct, math
import numpy as np
from horovod.mxnet.mpi_ops import size, local_size, rank, local_rank
parameter_index = 0
QueueType = [
"COORDINATE_REDUCE",
"REDUCE",
"COPY... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import absolute_import, print_function, with_statement, unicode_literals
import os
import re
import sys
import copy
import time
import types
import signal
import random
import fnmatch
import logging
import threading
import ... |
voter.py | """ Handles setting up voters so an election can be called """
import logging
import socket
import threading
import time
import SocketServer
from .config import Config
from .fle import FastLeaderElection
from .serialization import read_string, write_string
from .state import State
from .vote import Vote
class Voter... |
serialloop.py | """
Skiddy workaround with more regular updates of serial line
"""
import serial
from threading import Thread
from osgar.logger import LogWriter
from osgar.bus import BusShutdownException
class SerialLoop:
def __init__(self, config, bus):
bus.register('raw')
self.input_thread = Thread(target=s... |
You.py | # -*- coding: utf-8 -*-
import LINETCR
from LINETCR.lib.curve.ttypes import *
from datetime import datetime
# https://kaijento.github.io/2017/05/19/web-scraping-youtube.com/
import time,random,sys,json,codecs,threading,glob,requests,urllib
cl = LINETCR.LINE()
#cl.login(qr=True)
cl.login(token="Evw1Ka54ozd2ZnTFdVW9.01... |
model.py |
# Copyright (c) 2020, NVIDIA CORPORATION. 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 conditions ... |
newServer.py | #!/usr/bin/env python2
#-coding:utf8-#
import socket
import select
from EmailSender import EmailSender
import time
HOST = None
PORT = 45988
sock0 = 0
#TODO:modify print messages
bufsize = 1024
def monitoringServer(interval,ADDRESS,PASSWORD,TO_ADDR):
emailSender = Ema... |
keepkey.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum.util import bfh, bh2u, UserCancelled
from electrum.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT,
is_segwit_address)
from electrum import c... |
IIIPP.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
IIIPP.py: Mezclador de sonidos
'''
import pygame as pg
import tkinter as tk
import threading as th
import tkinter.ttk as ttk
import tkinter.messagebox as ms
import tkinter.simpledialog as sd
__author__ = 'E. Adrián Garro Sánchez (2014088081)'
__copyright__ = 'Copyright 2... |
prefix_mgr_client_tests.py | #!/usr/bin/env python3
#
# Copyright (c) 2014-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
fro... |
rpc_test.py | import concurrent.futures
import contextlib
import json
import os
import sys
import threading
import time
from collections import namedtuple
from functools import partial
from threading import Event
from threading import Lock
from unittest import mock
import torch
import torch.nn as nn
import torch.distributed as dis... |
cleaner_TFIDF.py | import os
import nltk
import re
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
from nltk.corpus import wordnet
import pathlib
from multiprocessing import Process,Lock,Value
import itertools
import numpy as np
from sklearn.model_selection import cross_val_score
def speedy(dirs,n_jobs=4,targe... |
logs.py | import logging
import logging.handlers
from threading import Thread
import platform
class Log:
def __init__(self):
self.th = None
@staticmethod
def get_logger(name):
return logging.getLogger(name)
def listener_start(self, file_path, name, queue):
"""
Listener perform ... |
test_persist.py | #
# Copyright (C) 2014 Dell, 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... |
utils.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... |
Model.py | """
Base classes Model and Sampler are defined here.
"""
# Changeset history
# 22/03/2007 -DH- Added methods to query the StepMethod's state and pass it to database.
# 20/03/2007 -DH- Separated Model from Sampler. Removed _prepare().
# Commented __setattr__ because it breaks properties.
__docformat__ = 'reStructuredT... |
bridge.py | #!/usr/bin/env python
#
# Copyright (c) 2018-2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
#
"""
Rosbridge class:
Class that handle communication between CARLA and ROS
"""
import os
import pkg_resources
try:
import que... |
client.py | import datetime
import hashlib
import logging
import multiprocessing
import pathlib
from scrapy import signals
from scrapy.crawler import CrawlerProcess
from scrapy.signalmanager import dispatcher
from app.crawler import WallpapersSpider
from app.utils import download_file, store_file
class Client:
"""
Appl... |
run.py | import time
import datetime
from create_data import main, main2, main3, main4
def get_parm():
with open('parm.txt', 'r', encoding='utf-8') as f:
res = f.read()
parm = res.split(',')
n = int(parm[0])
t = int(parm[1])
return n, t
def updtae_parm(n, t):
with open('parm.txt', 'w', encod... |
Maker.py | '''
classes and methods to analyze observations of astrophysical spectra
'''
import os
from datetime import date
from datetime import datetime
import pickle
import warnings
try:
import multiprocessing as mp
except:
print(' your version of Python does not support multiprocessing \n you will not be able to use m... |
Snake.py | from os import system, name as __UserOS__
from time import sleep
from threading import Thread
from random import randint
def UnixController(game,snake):
import sys, tty, termios
dir = {65:0,67:1,66:2,68:3}
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
tty.setcbreak(sys.stdin.fi... |
labby.py | """
A wamp client which registers a rpc function
"""
import asyncio
import asyncio.log
import getpass
import logging
import os
from getpass import getuser as _getuser
from os import getenv
from socket import gethostname as _gethostname
from time import sleep
from typing import Callable, Dict, List, Optional
import aut... |
zeromq_test.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Thomas Jackson <jacksontj.89@gmail.com>`
'''
# Import python libs
from __future__ import absolute_import
import os
import threading
import time
import zmq.eventloop.ioloop
# support pyzmq 13.0.x, TODO: remove once we force people to 14.0.x
if not hasattr(zmq.eventl... |
websockets.py | #!/usr/bin/env python3
#
# Electrum ABC - lightweight eCash client
# Copyright (C) 2020 The Electrum ABC developers
# Copyright (C) 2015 Thomas Voegtlin
#
# 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 t... |
segment.py | import os
import time
import shlex
import subprocess as sp
import multiprocessing as mp
from . import blender
from . import freesurfer
from .database import db
def init_subject(subject, filename):
"""Run the first initial segmentation for a subject's anatomy. This function runs
autorecon-all, then imports th... |
multiprocessing_normal.py | import time
import sys
from random import randint
from multiprocessing import Process
from logger_tt import setup_logging
from logging import getLogger
__author__ = "Duc Tin"
logger = getLogger(__name__)
setup_logging(use_multiprocessing=True)
def worker(arg):
logger.info(f'child process {arg}: started')
t... |
puppy.py | # coding=utf-8
import time
import select
import sys
import os
from threading import Thread
from pid import PID
from car import Car
from car_speed import Car_Speed
from car_servo import Car_Servo
from ultrasonic import Ultrasound
import RPi.GPIO as GPIO
import numpy as np
class Puppy:
# PIN settings
IN1 = 12... |
eosimapp.py | import tkinter as tk
from tkinter import messagebox
import os
import threading
from http.server import HTTPServer, SimpleHTTPRequestHandler
from eosim.gui.mainapplication import MainApplication
import argparse
import logging
def main(loglevel):
# Start web server in the cesium_app directory (which contai... |
Abstract.py | import abc, threading, time, logging, traceback
logger = logging.getLogger('danmu')
# This client will auto-reload if exception is raised inside and write a log
# it is deprecated once used
# log of main start and thread is recorded
# If you want to close it outside, just set the deprecated flag to True
# Ins... |
overdash.py | import wx
import threading
import time
import lcm
import random
import forseti2
import configurator
import settings
BLUE = (24, 25, 141)
GOLD = (241, 169, 50)
RED = (183, 24, 24)
GREEN = (20, 198, 14)
class Overrider(object):
def __init__(self):
self.lc = lcm.LCM(settings.LCM_URI)
self.thread = t... |
Programar.py | import random
import re
import os
import time
import MySQLdb
from multiprocessing import Process
WORDS = ["DELAY", "SOCORRO"]
#PRIORITY = 19
con = MySQLdb.connect('127.0.0.1', 'root', 'watchdogs')
con.select_db('wdp')
def delay():
#sleep(10)
sql = con.cursor()
sql.execute('UPDATE sensors SET status=... |
gui.py | from tkinter import *
from tkinter import ttk
from threading import Thread
import time
import path_finder
import os, subprocess
from tkinter.filedialog import askdirectory
import dependency_manager
import config
from PIL import Image, ImageTk
import webbrowser
import utilities
import functools
import version_c... |
runServer.py |
# encoding: UTF-8
import sys
if sys.version_info < (3, 0):
reload(sys)
sys.setdefaultencoding('utf8')
sys.path.append('../')
sys.path.append('../../')
sys.path.append('../../vnpy/trader/')
import multiprocessing
import signal
from time import sleep
from datetime import datetime, time
import vnpy.trader.vt... |
job_server.py | #!/usr/bin/python
import SimpleHTTPServer
import SocketServer
from multiprocessing.process import Process
import json
import subprocess
class S(SimpleHTTPServer.SimpleHTTPRequestHandler):
def get_slurm(self):
p = subprocess.Popen('squeue -h -t R -o %%A', shell=True,
stdout=su... |
multiprocess.py | from __future__ import absolute_import
import logging
import time
from multiprocessing import Process, Queue as MPQueue, Event, Value
try:
from Queue import Empty
except ImportError: # python 2
from queue import Empty
from .base import (
AUTO_COMMIT_MSG_COUNT, AUTO_COMMIT_INTERVAL,
NO_MESSAGES_WAIT_... |
penv.py | from multiprocessing import Process, Pipe
import gym
def worker(conn, env):
while True:
cmd, data = conn.recv()
if cmd == "step":
obs, reward, done, info = env.step(data)
if done:
obs = env.reset()
conn.send((obs, reward, done, info))
... |
name_server.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : name_server.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 01/22/2018
#
# This file is part of Jacinle.
# Distributed under terms of the MIT license.
import collections
import queue
import threading
import time
import zmq
from jacinle.c... |
main.py | import requests
import bs4
import threading
import re
import traceback
import json
import RandomHeaders
import time
from selenium import webdriver
def grabSite(url, retry=False):
failCount = 0
headers = {'User-Agent': '{}'.format(RandomHeaders.LoadHeader())}
try:
res = requests.get(url, headers=headers, timeout=5... |
preparer.py | # -*- coding: utf-8 -*-
# Copyright CERN since 2020
#
# 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 ... |
TanquesNamespace.py | from opcua import ua, Server
import time
import threading
from opcua.server.history_sql import HistorySQLite
import os
import random
'''
*********************************************** Servidor OPC-UA ***********************************************************
Implementación del servidor completo para la aplicación d... |
app.py | #!/usr/bin/env python
from flask import Flask, request, redirect, session, url_for, render_template, Response, jsonify, make_response, send_from_directory
from flask_assets import Environment, Bundle
from flask_mail import Mail
import urllib.request, urllib.parse, urllib.error
import json
import random
import base64
i... |
server.py | import pika
import functools
import threading
import json
import gc
import logging
logger = logging.getLogger('skyamqp.queue.server')
logger.setLevel(logging.WARNING)
class Queue_Server_Thread:
def __init__(self,
connection: pika.BlockingConnection,
queue: str,
group: str,
on_message: None,
prefe... |
run_100times.py | #!/usr/bin/env python
from __future__ import print_function
import subprocess
import threading
import os
import time
import numpy as np
import ROOT
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description='run MT')
add_arg = parser.add_argument
add_arg('file_name', help... |
athenad.py | #!/usr/bin/env python3
import base64
import hashlib
import io
import json
import os
import sys
import queue
import random
import select
import socket
import threading
import time
from collections import namedtuple
from functools import partial
from typing import Any
import requests
from jsonrpc import JSONRPCResponseM... |
ai_server.py | __author__ = "Jerry Overton"
__copyright__ = "Copyright (C) 2022 appliedAIstudio LLC"
__version__ = "0.0.1"
# needed to read the environment variables
import os
# needed to run the ai
from ai_framework.ai import AI
# needed to run the ai as a remote server
import rpyc
# needed to start the server in its own thread
... |
perf.py | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Basic pyauto performance tests.
For tests that need to be run for multiple iterations (e.g., so that average
and standard devia... |
test_kieli.py | import io
import json
import threading
import sys
import pytest
import kieli
def test_initialization():
client = kieli.LSPClient()
client._stdin = io.BytesIO()
expected_stdin_prefix = b"Content-Length: 119\r\n\r\n"
# must not hard-code this as bytes because the order of things in the json
# i... |
rest.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from flask import Flask, request, jsonify, abort, render_template, url_for
from flask.json import JSONEncoder
from flask.views import View
from bson.objectid import ObjectId
from datetime import datetime
from urllib.request import Request, urlopen
import threading
import... |
test_ftplib.py | """Test script for ftplib module."""
# Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS
# environment
import ftplib
import asyncore
import asynchat
import socket
import io
import errno
import os
import time
try:
import ssl
except ImportError:
ssl = None
from unittest import Tes... |
main.py | # This is a sample Python script.
# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
import random
import threading
import time
import sys
from ui import Ui_MainWindow
from PyQt5.QtWidgets import QApplication, QMainWindo... |
pyafka.py |
import uuid
import threading
import logging
from confluent_kafka import DeserializingConsumer
from pyafkalib.deserializers import StringDeserializer
def kafka_consumer(bootstrap_servers : str, topics: list, group_id: str = None, deserializer = None, daemonic: bool = None) -> callable:
if group_id is None:
... |
patch.py | """
mcef-codec-patch
"""
MCEF_VERSION = "1.31"
PATCHES_DIR = "patches"
from hash import sha1_of_file
import os
import sys
if sys.platform == "linux":
cef_platform = "linux64"
elif sys.platform == "darwin":
cef_platform = "mac64"
elif sys.platform == "win32":
cef_platform = "win64"
else:
print("Unsuppo... |
test_replication.py | """
Copyright (c) 2008-2014, Jesus Cea Avion <jcea@jcea.es>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of... |
views.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2015-2018 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... |
BeadsEeSerial.py | #!/usr/bin/env /usr/bin/python3
# -*- coding: utf-8 -*-
# -----------------------------------------------
# Beads End effector Control
#
# The Apache License 2.0
# Copyright (C) 2020-2021 myasu.
# -----------------------------------------------
import logging
import os
import serial
import sys
import threading
import ... |
server.py | # Copyright 2020 Tabacaru Eric
#
# 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 ... |
SpatialAlignment.py | import cv2
import numpy as np
import os
import common
import config
import ecc_homo_spacetime
DONT_USE_MATLAB_FIT_ECC_RECORD_SYNTACTIC_SUGAR = True
if config.USE_MULTITHREADING == True:
import threading
from threading import Thread
import multiprocessing
class Globals:
crossref = None;
... |
s1_ss_pattern_finder.py | import os, sys
import json
import time
import math
from multiprocessing import Process
# 获取当前路径, 通过anchor文件获取项目root路径
this_file_path = os.path.split(os.path.realpath(__file__))[0]
this_path = this_file_path
root_path = this_file_path
while this_path:
if os.path.exists(os.path.join(this_path, 'sosweety_root_anchor.... |
test_multiplexed.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import multiprocessing
import time
import pytest
import thriftpy2
from thriftpy2.protocol import (
TBinaryProtocolFactory,
TMultiplexedProtocolFactory
)
from thriftpy2.rpc import client_context
from thriftpy2.server import TThreadedSer... |
orville_imager.py | #!/usr/bin/env python3
import os
import sys
import copy
import json
import time
import queue
import ephem
import numpy
import ctypes
import shutil
import signal
import logging
from logging.handlers import TimedRotatingFileHandler
import argparse
import threading
import subprocess
from datetime import datetime
from col... |
__main__.py | import argparse
import gdspy
import threading
import signal
import os
import time
import traceback
import re
import polyp
def main():
parser = argparse.ArgumentParser(description='Polyp layout renderer command line tool')
parser.add_argument('layout', type=argparse.FileType('r'),
help='path t... |
shooting_star.py | # from trend import trend
# import requests
#print(trend("AAPL"))
#### check for the previous trend ####
#### Upward trend required for this pattern ####
def shooting_star(arg):
# string = 'https://finnhub.io/api/v1/stock/candle?symbol='+ "AAPL" +'&resolution=D&count=1&token=bq24qknrh5rc5i... |
autocast_variable_test.py | # Copyright 2019 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... |
shared_everything_raw.py | #!/usr/bin/env python
from __future__ import print_function
import sys
import threading
import htcondor
import utils
def do_submit(txn, submit):
ident = threading.get_ident()
submit["JobBatchName"] = str(ident)
result = submit.queue(txn, 1)
print(ident, result)
def test_multi_threaded_submit_raw... |
gui.py | import random
import threading
from kivy import Config
from kivy.animation import Animation
from kivy.app import App
from kivy.clock import Clock
from kivy.uix.popup import Popup
from kivy.uix.stacklayout import StackLayout
from kivy.uix.textinput import TextInput
import startup
from ScheduleGraph import MyGraph
from... |
tinyshell.py | ## Title: tinyshell.py
## Author: Joe Vest
## Description: Command console framework that control webshells
"""
___________ __ _________ __ __ __
\__ ___/|__| ____ ___ __ / _____/| |__ ____ | | | |
| | | |/ \ | |\_____ \ | | \_/ __ \| | | |
| ... |
kaisa_gateway.py | """
"""
import base64
import json
import threading
import sys
import requests
import math
import pytz
from Crypto.Cipher import AES
from datetime import datetime
from typing import Dict, Any, List
from urllib import parse
from vnpy.api.rest import RestClient, Request
from vnpy.api.websocket import WebsocketClient
from... |
execution.py | import time
import threading
from typing import Callable, Union, Tuple, List, Any
def executeWithRetries(proc: Callable, args: Union[Tuple, List], maxRetries: int, sleepTime: float=0):
retries = 0
while True:
try:
return proc(*args)
except KeyboardInterrupt:
raise
... |
test_util.py | import mock
from os import environ
from iml_common.lib import util
from iml_common.test.iml_unit_testcase import ImlUnitTestCase
def target_func():
return
class PreservePermissionTestCase(ImlUnitTestCase):
def test_file(self):
for filename, st_mode, st_uid, st_gid in [
("sidney", 493, 2,... |
challenge_runner.py | #!/usr/bin/env python2
import os
import re
import signal
import subprocess as sp
from time import time, sleep
import threading
from common import IS_DARWIN, IS_LINUX, IS_WINDOWS, try_delete
from elftools.elf.elffile import ELFFile
FUZZBALL = "/export/scratch/vaibhav/fuzzball-adaptorsynth/exec_utils/fuzzball"
# FUZZB... |
cli.py | # -*- coding: utf-8 -*-
"""
flask.cli
~~~~~~~~~
A simple command line application to run flask apps.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
from threading import Lock, Thread
from functools import update_wrapper
import click
... |
runner.py | import threading
import eventlet
import socketio
from eventlet import patcher, wsgi
from app import app, sio
patcher.monkey_patch(all=True)
class SocketIoRunner(object):
def __init__(self, url):
self.host, port_str = url.split(':')
self.port = int(port_str)
self.server = None
#... |
multi_process_crawlers.py | import sys, os, bz2, json, time, logging
from datetime import datetime
from tweepy import OAuthHandler
from tweepy import Stream
from tweepy.streaming import StreamListener
from multiprocessing import Process, Queue
class StdOutListener(StreamListener):
""" A listener handles tweets that are received from the str... |
main.py | # __author__ = 'ChienHung Chen in Academia Sinica IIS'
import os, sys
import os.path as osp
import json
import pickle
import numpy as np
import matplotlib
import xml.etree.ElementTree as ET
import argparse
import platform
import itertools
import time
import threading
import matplotlib.pyplot as plt
import torch
from ... |
unittest_nn_examples.py | """
Unit tests for nn_examples.py
-- kandasamy@cs.cmu.edu
"""
# pylint: disable=no-member
# pylint: disable=no-name-in-module
# pylint: disable=invalid-name
import os
# Local imports
from utils.base_test_class import BaseTestClass, execute_tests
from nn import nn_examples
from nn.nn_visualise import visualise_lis... |
core.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
#... |
robogen.py | import time
import os
import sys
import cPickle as pickle
import argparse
from argparse import RawTextHelpFormatter
from multiprocessing.pool import Pool
from multiprocessing.process import Process
import threading
import Queue
import msvcrt
import cProfile, pstats, StringIO
from rgkit import run as rgrun
from rgkit.g... |
driver.py | # Copyright 2020 Uber Technologies, 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 applica... |
params.py | #!/usr/bin/env python3
"""ROS has a parameter server, we have files.
The parameter store is a persistent key value store, implemented as a directory with a writer lock.
On Android, we store params under params_dir = /data/params. The writer lock is a file
"<params_dir>/.lock" taken using flock(), and data is stored in... |
email.py | from threading import Thread
from flask import current_app
from flask_mail import Message
from app import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(subject, sender, recipients, text_body, html_body):
msg = Message(subject, sender=sender, recipients=re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.