source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
ObstacleManager.py | # Obstacle
import random
import threading
import time
import math
# try:
# from LaserManager import LaserManager
# gpio_module_present = True
# except:
# gpio_module_present = False
from Properties import Properties
from BallTracker import BallTracker
class ObstacleManager:
# Singleton instance
... |
process_write_file.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# python version 2.7.6
from multiprocessing import Process
import time
'''
小例子进行多线程对文件操作传递文件句柄或多进程中生成文件句柄时的区别。
'''
def task(name,f):
f.write('hello')
f.flush()
def task_demo(name):
f = open('text.txt','a+')
f.write('hello')
if __name__ == '__main__':
f = open('text.t... |
test_cogapp.py | """ Test cogapp.
http://nedbatchelder.com/code/cog
Copyright 2004-2019, Ned Batchelder.
"""
from __future__ import absolute_import
import os
import os.path
import random
import re
import shutil
import stat
import sys
import tempfile
import threading
from .backward import StringIO, to_bytes, TestCase, PY3
fr... |
server.py | import os
import queue
import signal
import subprocess
import sys
import threading
import time
from concurrent.futures import ThreadPoolExecutor
import grpc
from dagster import check, seven
from dagster.core.code_pointer import CodePointer
from dagster.core.definitions.reconstructable import (
ReconstructableRepo... |
handler.py | from logging import Handler
from threading import Thread, Event, Lock
from traceback import format_exception as fmtex
from elasticsearch import helpers as eshelpers
from elasticsearch import Elasticsearch, Urllib3HttpConnection
from esloghandler.utils import (
INDEX_NAME_FUNCS,
File,
AuthType,
IndexName... |
main.py | from subprocess import Popen, PIPE
from threading import Thread
from queue import Queue, Empty
import atexit
import os
import sys
agent_processes = [None, None]
t = None
q = None
def cleanup_process():
global agent_processes
for proc in agent_processes:
if proc is not None:
proc.kill()
def... |
test_utils_zmq_sockets_centralization.py | import struct
import traceback
import zmq
import time
import threading
import logging
from timeit import default_timer as timer
import numpy as np
from automon.common_messages import MessageType, prepare_message_header
from test_utils.test_utils_zmq_sockets import event_monitor_client, event_monitor_server
logging = lo... |
routes.py | from app import app
from flask import jsonify
from flask import request
from hashlib import md5
from threading import Thread
import urllib3
import os
import smtplib
#Для хранения задач используем список словарей
tasks = [
{
'id' : 0,
'status' : None,
'md5' : None,
'url' : None
}
]
#Основная функция для вычи... |
aadada.py | __author__ = 'Aaron Yang'
__email__ = 'byang971@usc.edu'
__date__ = '8/12/2020 10:27 AM'
import time
import threading
class Singleton(object):
_instance_lock = threading.Lock()
def __init__(self):
# time.sleep(1)
pass
@classmethod
def get_instance(cls, *args, **kwargs):
if n... |
grader.py | import os, sys, threading, json, shutil, base64, requests, io, traceback, html, shlex
from flask import Flask, request, Response
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
from threading import Thread
from subprocess import *
from time import time
import subprocess
import logging
\
debug = "--debu... |
socksserver.py | #!/usr/bin/env python
# SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved.
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# SOCKS proxy server/client
#
# Author:
# Alberto Soli... |
pub_sub.py | """
Using both records and stream API endpoints to write / read from
a Gretel Project in near real-time. This script will create
a temporary project and send fake records and continuously
consume the labeled records.
Usage::
python pub_sub.py YOUR_API_KEY
"""
import sys
import threading
import time
from faker im... |
pyenergy.py | #!/usr/bin/env python3
"""Python Energy Logger"""
import numpy as np
from os import nice
from time import sleep
from math import sqrt, cos
from signal import signal, SIGINT
from scipy.optimize import leastsq
from multiprocessing import Process, Pipe
def signal_handler(signal, frame):
"""Allows graceful exit"""
... |
Hiwin_RT605_ArmCommand_Socket_20190627160026.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import math
import enum
pos_feedback_times = 0
mode_feedback_times = 0
msg_feedback = 1
#接收策略端命令 用Socket傳輸至控制端電腦
import socket
##多執行序
i... |
test_datapipe.py | import itertools
import numpy as np
import os
import os.path
import pickle
import random
import sys
import tarfile
import tempfile
import warnings
import zipfile
import unittest
from unittest import skipIf
from typing import (
Any, Awaitable, Dict, Generic, Iterator, List, NamedTuple, Optional, Tuple,
Type, Ty... |
dag_processing.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... |
delete_history.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from urllib import urlopen
from bs4 import BeautifulSoup as BS
from threading import Thread
import threading
def search_history(bbs_count):
print 'Searching...%s' %threading.currentThread
for i in range(*bbs_count):
url = 'http://xxxx.co.kr/xx/index.xxx?xxx=xxxx&page... |
PlexConnect.py | #!/usr/bin/env python
"""
PlexConnect
Sources:
inter-process-communication (queue): http://pymotw.com/2/multiprocessing/communication.html
"""
import sys, time
from os import sep
import socket
from multiprocessing import Process, Pipe
import signal, errno
from Version import __VERSION__
import DNSServer, WebServer... |
Watcher-linux.py | from __future__ import print_function
from optparse import OptionParser
from websocket import create_connection
import os
import threading
import time
import traceback
'''
@Author Jiage
@Function send the data to collector
@Date 12 June 2021
'''
def send(_options):
while True:
try:
ws = create... |
polybeast_learner.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... |
cam_utils.py | # From http://www.pyimagesearch.com/2015/12/21/increasing-webcam-fps-with-python-and-opencv/
import cv2
import datetime
from threading import Thread
from pkg_resources import parse_version
OPCV3 = parse_version(cv2.__version__) >= parse_version('3')
def capPropId(prop):
return getattr(cv2 if OPCV3 else cv2.cv,
... |
hptune.py | # -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. 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... |
test_parallel_backend.py | # -*- coding: utf8 -*-
from __future__ import print_function, absolute_import
"""
Tests the parallel backend
"""
import threading
import multiprocessing
import random
import os
import sys
import subprocess
import signal
from numba import config, utils
if utils.PYVERSION >= (3, 0):
import queue as t_queue
impo... |
02.py | from threading import Thread, Lock
c = 0
lock = Lock()
def count_30000():
global c
lock.acquire()
try:
while c < 30000:
c += 1
print(c)
finally:
lock.release()
def count_10000():
global c
x = 340
lock.acquire()
try:
while c < 100000:
... |
relayserver.py | # -*- coding: utf-8 -*-
"""
Simple network relay program - allows any number of clients to make a network
connection, relays sent data between all clients. Can log traffic to local db.
Command-line parameters:
--port PORT port to run on (default 9000)
--db [PATH] SQLite database path to log to, if any.
... |
datasets.py | # Dataset utils and dataloaders
import glob
import logging
import math
import os
import random
import shutil
import time
from itertools import repeat
from multiprocessing.pool import ThreadPool
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
import torch.nn.functional ... |
main.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'jinmu333'
from math import inf
import threading
import time
import tkinter as tk
import cv2
import lib.img_function as predict
import lib.img_math as img_math
import lib.img_excel as img_excel
import lib.img_sql as img_sql
from lib.img_api import api_pic
imp... |
NRFReader.py | from threading import Thread
from struct import *
import random
import time
class NRFReader:
def run(self):
while True:
import DaloyGround
packet = (random.uniform(0, 10), random.uniform(0, 10), random.uniform(0, 10), random.uniform(0, 10))
DaloyGround.instance.registerEntry(packet)
time.sleep(0.5)
de... |
concurrent_select.py | #!/usr/bin/env impala-python
#
# 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 (... |
__init__.py | #
# Copyright 2013-2015 eNovance <licensing@enovance.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
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
example_3.py | # Importing necessary libraries
import cv2
import time
import threading
from webrtc_streaming import start_streaming
# Class to manage the video capture stream
class VideoCaptureWithoutBuffer():
# Function constructor for class
def __init__(self, cap):
# Initializing attributes
self... |
downloader.py | import sys
import threading
import time
import colorama
from config import Config as con
from helper import bcolors
from utils import download_course, download_track, get_completed_tracks, get_completed_courses, get_all_courses
def main(argv):
if argv[0] == 'settoken':
print_dash()
con.set_token... |
test_win32file.py | import unittest
from pywin32_testutil import str2bytes, TestSkipped, testmain
import win32api, win32file, win32pipe, pywintypes, winerror, win32event
import win32con, ntsecuritycon
import sys
import os
import tempfile
import threading
import time
import shutil
import socket
import datetime
import random
... |
tool.py | #!/usr/bin/env python
##
# 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
#... |
qt_root.py | import os
import pathlib
import sys
from PyQt5.QtCore import QTimer
from PyQt5 import QtCore, QtGui
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QFileDialog, QMainWindow, QApplication, QWidget, QComboBox, QLineEdit, QRadioButton, QSlider, QCheckBox, QMessageBox
import threading
import configparser
from rl... |
get_cov.py | """
Script to make coverage track
@author: Alicia Schep
"""
##### IMPORT MODULES #####
# import necessary for python
import os
import multiprocessing as mp
import itertools
import numpy as np
import pysam
import traceback
import pyximport; pyximport.install()
from pyatac.tracks import CoverageTrack
from pyatac.chunk ... |
senal.py | from threading import Thread,Semaphore
from time import sleep
def establece_conexion():
sleep(1)
print("Ya está establecida la conexión")
sem.release()
def manda_datos():
print("Quiero mandar datos")
sem.acquire()
print("Enviando datos. ¡Listo!")
sem = Semaphore(0)
Thread(target = manda_datos... |
test_messaging.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
"""Tests for JSON message streams and channels.
"""
import collections
import fun... |
plutus.py | # Plutus Bitcoin Brute Forcer
# Made by Isaac Delly
# https://github.com/Isaacdelly/Plutus
# Donate: 1B1k2fMs6kEmpxdYor6qvd2MRVUX2zGEHa
import requests
import os
import binascii
import ecdsa
import hashlib
import base58
import time
import sys
from multiprocessing import Process, Queue
class pause: # Co... |
CartPoleESParallel.py | import gym
import time
# from keras.models import Sequential
# from keras.layers import Dense, Activation
import collections
from matplotlib import pyplot as plt
import numpy as np
from math import sqrt
from timeit import default_timer as timer
import multiprocessing
import thread
# Suppress Warnings
ERROR = 40
gym.... |
server.py | from tensorflow.keras.applications import ResNet50
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.applications.resnet50 import preprocess_input
from tensorflow.keras.applications.resnet50 import decode_predictions
from threading import Thread
from PIL import Image
import numpy as np... |
auto_test.py | """Tests for letsencrypt-auto"""
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from contextlib import contextmanager
from functools import partial
from json import dumps
from os import chmod, environ, makedirs
from os.path import abspath, dirname, exists, join
import re
from shutil import copy, rmtree
... |
process.py | # -*- coding: utf-8 -*-
# Import python libs
from __future__ import absolute_import, with_statement
import copy
import os
import sys
import time
import errno
import types
import signal
import logging
import threading
import contextlib
import subprocess
import multiprocessing
import multiprocessing.util
# Import salt... |
Navigator_rs_gazebo.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
... |
multiple_tpus_test.py | # Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
dollarone.py | #!/usr/bin/python
# -*- coding:utf-8 -*-
import time
import threading
import StringIO
import datetime
import pygame
import urllib2
from pygame.locals import *
import pygamehelper
import twitter
pygame.init()
screen = pygame.display.set_mode((640,480),pygame.FULLSCREEN|pygame.HWSURFACE|pygame.DOUBLEBUF)
pygame.mous... |
bladelius.py | #!/usr/bin/python3
# ____ __
# / _/___ ___ ____ ____ _____/ /______ _
# / // __ `__ \/ __ \/ __ \/ ___/ __/ ___/ (_)
# _/ // / / / / / /_/ / /_/ / / / /_(__ ) _
#/___/_/ /_/ /_/ .___/\____/_/ \__/____/ (_)
# /_/
f... |
tabletmanager.py | #!/usr/bin/python
import warnings
# Dropping a table inexplicably produces a warning despite
# the "IF EXISTS" clause. Squelch these warnings.
warnings.simplefilter("ignore")
import logging
import os
import signal
from subprocess import PIPE
import threading
import time
import unittest
import environment
import util... |
main.py | import datetime
import logging
import os
import threading
import time
# from matplotlib import pyplot as plt
import server
from data_collector import DataCollector
from devices.ir_camera import IrCamera
from devices.rgb_camera import RgbCamera
from ir_frame_collector import IrFrameCollector
import signal
import sys
... |
multi_process_queue.py | #coding=utf-8
'''
Created on 2015年3月30日
@author: hongtu_zang
'''
import time
from multiprocessing import Process,Queue
MSG_QUEUE = Queue(5)
def startA(msgQueue):
while True:
if msgQueue.empty() > 0:
print 'queue is empty %d' % (msgQueue.qsize())
else:
msg = msgQueue.get()
... |
kivy_ui.py | import json
import re
import time
from copy import copy
from datetime import datetime
from functools import partial
from subprocess import Popen, PIPE, STDOUT
from threading import Thread
from collections import namedtuple
from kivy.logger import Logger
import io
import os
import atexit
import yaml
from PIL import Ima... |
__init__.py | from __future__ import unicode_literals, print_function
import json
import argparse
import threading
from awsshell import shellcomplete
from awsshell import autocomplete
from awsshell import app
from awsshell import docs
from awsshell import loaders
from awsshell.index import completion
from awsshell import utils
_... |
batcher.py | #Most of this file is copied form https://github.com/abisee/pointer-generator/blob/master/batcher.py
import queue as Queue
import time
from random import shuffle
from threading import Thread
import numpy as np
import tensorflow as tf
from . import config
from . import data
import random
random.seed(1234)
class Ex... |
trace_order.py | from flask_jwt_extended import jwt_required
from flask_restful import Resource, reqparse
import json
import threading
import config
import model
import resources.project as project
import resources.issue as issue
from copy import deepcopy
import util as util
from model import db, TraceOrder, TraceResult
import resour... |
weixin.py | #!/usr/bin/env python
# coding: utf-8
import qrcode
import urllib, urllib2
import cookielib
import requests
import xml.dom.minidom
import json
import time, re, sys, os, random
import multiprocessing
import platform
from collections import defaultdict
def catchKeyboardInterrupt(fn):
def wrapper(*args):
... |
tello.py | """Library for interacting with DJI Ryze Tello drones.
"""
# coding=utf-8
import logging
import socket
import time
from threading import Thread
from typing import Optional, Union, Type, Dict
import cv2 # type: ignore
from .enforce_types import enforce_types
threads_initialized = False
drones: Optional[dict] = {}
cl... |
daemonize.py | #!/usr/bin/env python
import Pyro4
import time
import signal
from multiprocessing import Process
@Pyro4.expose
class Thing(object):
def method(self, arg):
return arg * 2
def start_server():
daemon = Pyro4.Daemon()
uri = daemon.register(Thing)
print("uri={}".format(uri))
daemon.requestLo... |
Interceptor.py | print("Starting Interceptor imports... ")
import sys
import socket
from multiprocessing import Manager, Process
from re import search, sub
from os import getcwd
import io
import pyshark
import pem
from pyshark.capture.capture import Capture
from pyshark.capture.live_capture import LiveCapture
from pyshark.packet.pack... |
ImageConvertTool.py | """
Copyright (c) 2018-2021 The Forge Interactive Inc.
This file is part of The-Forge
(see https://github.com/ConfettiFX/The-Forge).
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
rega... |
kad.py | import json
import random
import socket
import socketserver
import threading
import time
from .bucketset import BucketSet
from .hashing import hash_function, random_id
from .peer import Peer
from .storage import Shelve
from .shortlist import Shortlist
from . import hashing
k = 20
alpha = 3
id_bits = 128
iteration_slee... |
home_window.py | """
coding:utf-8
file: home_window.py
@author: jiangwei
@contact: jiangwei_1994124@163.com
@time: 2020/5/9 22:03
@desc:
"""
import sys
from threading import Thread
from PyQt5.QtCore import pyqtSignal, QUrl
from PyQt5.QtGui import QIcon
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtWidgets import QWi... |
_e3dc_rscp_web.py | #!/usr/bin/env python
# Python class to connect to an E3/DC system through the internet portal
#
# Copyright 2017 Francesco Santini <francesco.santini@gmail.com>
# Licensed under a MIT license. See LICENSE for details
import websocket
import time
import struct
import hashlib
import threading # TODO: move to threading ... |
emailproxy.py | """A simple IMAP/SMTP proxy that intercepts authenticate and login commands, transparently replacing them with OAuth 2.0
SASL authentication. Designed for apps/clients that don't support OAuth 2.0 but need to connect to modern servers."""
__author__ = 'Simon Robinson'
__copyright__ = 'Copyright (c) 2021 Simon Robinson... |
lobby.py | import logging
import socket
from threading import Thread
from QRServer.lobby.lobbyclient import LobbyClientHandler
from QRServer.lobby.lobbyserver import LobbyServer
log = logging.getLogger('lobby_listener')
def lobby_listener(conn_host, conn_port):
log.info('Lobby starting on ' + conn_host + ':' + str(conn_po... |
classifier_rpc_worker_subsets_with_multiproc_2nd_cmpr.py | """An example of how to use your own dataset to train a classifier that recognizes people.
"""
# MIT License
#
# Copyright (c) 2016 David Sandberg
#
# 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 S... |
models.py | import time
import multiprocessing
class ModelProduct(object):
@classmethod
def process(cls, file_storage):
p = multiprocessing.Process(target=cls._process, args=(file_storage,))
p.start()
return True
@classmethod
def get_result(cls, file_name):
try:
with ... |
utils.py | from __future__ import print_function
from os.path import dirname, join
from six.moves.http_client import HTTPConnection
from threading import Thread
from six.moves.BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from socket import error
from sys import stderr
from re import search
from collective.solr.local ... |
test_kernel.py | # coding: utf-8
"""test the IPython Kernel"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import io
import os.path
import sys
import nose.tools as nt
from IPython.testing import decorators as dec, tools as tt
from ipython_genutils import py3compat
from IPytho... |
VideoSelect.py | from tkinter import *
from tkinter import messagebox
import os
import imageio
import threading
import time
from PIL import Image, ImageTk
import cv2
from base_logger import getLogger
from win32api import GetSystemMetrics
import math
class VideoSelect:
class VideoFrame:
def __init__(self, root, max_width,... |
rabbitmq_transport.py | # -*- coding: utf-8 -*-
from Queue import Queue
import pika
import ssl
from threading import Thread
import time
from beaver.transports.base_transport import BaseTransport
from beaver.transports.exception import TransportException
class RabbitmqTransport(BaseTransport):
def __init__(self, beaver_config, logger=N... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
room_list.py | # this is the class that stores the list of rooms
# maybe shouldn't be it's own class idk
import room
import requests
import json
from bs4 import BeautifulSoup as bs
import threading
class room_list(object):
# the constructor for the room list class which handles operations on multiple rooms
# file_name is th... |
server.py | """
Troop Server
------------
Real-time collaborative Live Coding with FoxDot and SuperCollder.
Sits on a machine (can be a performer machine) and listens for incoming
connections and messages and distributes these to other connected peers.
"""
from __future__ import absolute_import
try:
im... |
collector_test.py | import ast
import logging
import threading
import time
import unittest
import six
from plop.collector import Collector, PlopFormatter
class CollectorTest(unittest.TestCase):
def filter_stacks(self, collector):
# Kind of hacky, but this is the simplest way to keep the tests
# working after the inte... |
test_threadutils.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.core.thread_utils import SharedTable
from multiprocessing import Process
import unittest
import random
import... |
parallel_validation.py | # Copyright © 2020 Interplanetary Database Association e.V.,
# Planetmint and IPDB software 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 multiprocessing as mp
from collections import defaultdict
from planetmint import App, BigchainDB
from plane... |
archiver.py | import tkinter as tk
from tkinter import ttk
from tkinter import filedialog
import os.path as path
import os
import sys
import shutil
import threading
PROGRAM_NAME = 'Archiver'
PROGRAM_PATH = path.abspath( path.dirname(sys.argv[0]) )
ICON_PATH = path.join(PROGRAM_PATH, 'icon', 'archiver.ico' )
AVAIABLE_FORMATS = [f... |
cmake.py | # Copyright (c) Pypperoni
#
# Pypperoni is licensed under the MIT License; you may
# not use it except in compliance with the License.
#
# You should have received a copy of the License with
# this source code under the name "LICENSE.txt". However,
# you may obtain a copy of the License on our GitHub here:
# https://gi... |
__init__.py | #############################################################################
# Copyright Kitware 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/licen... |
loader.py | # Copyright (c) 2017-present, Facebook, 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... |
provisioner.py | #!/usr/bin/env python3
import os
import sys
import time
import json
import flask
import jinja2
import random
import string
import logging
import os.path
import requests
import functools
import threading
from airtable import airtable
from flask import request
from collections import namedtuple
from logging.handlers impo... |
train_pg_f18.py | """
Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam
Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany
"""
import numpy as np
import tensorflow as tf
import gym
import logz
import os
import time
im... |
deploy.py | #!/usr/bin/env python3
from lib.boto_utils import BotoUtils
from flask import Flask, request, send_from_directory, redirect
from time import sleep
from multiprocessing import Process
from botocore.exceptions import ClientError
import requests
from subprocess import check_output
import subprocess
import shutil
import re... |
coordinator_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... |
test_pdb.py | # A test suite for pdb; not very comprehensive at the moment.
import doctest
import os
import pdb
import sys
import types
import unittest
import subprocess
import textwrap
from contextlib import ExitStack
from io import StringIO
from test import support
# This little helper class is essential for testin... |
exp_circle.py | from lib_fin_simple import *
from time import sleep
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
import numpy as np
from lib_camera import Camera
import threading
from lib_leds import LEDS
from lib_depthsensor import DepthSensor
from lib_fin import Fin
from lib_photodiode import Photodiode
... |
python_semaphore.py | #coding=utf-8
import threading,time,random
#BoundedSemaphore调用时如果计数器的值超过了初始值会抛出异常;但是Semaphore不会
#semaphore=threading.Semaphore(3)#同一时间只能有3个线程处于运行状态
semaphore=threading.BoundedSemaphore(3) #同一时间只能有3个线程处于运行状态
def run (ii):
semaphore.acquire() # 获得信号量:信号量减一
print(ii,'号车可以进入')
time.sleep(random.randint(0,10)*1)
pri... |
settings_20210906111307.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... |
backlog.py | from sys import stdout
from threading import Thread
from time import sleep
from mpipe.Pipeline import Pipeline
from mpipe.UnorderedStage import UnorderedStage
def write(value):
stdout.write(str(value))
stdout.flush()
def inc(x):
sleep(0.1)
write('+')
return x+1
def dec(x):
sleep(0.2)
wr... |
wspbus.py | """An implementation of the Web Site Process Bus.
This module is completely standalone, depending only on the stdlib.
Web Site Process Bus
--------------------
A Bus object is used to contain and manage site-wide behavior:
daemonization, HTTP server start/stop, process reload, signal handling,
drop privileges, PID f... |
cloud_agent.py | #!/usr/bin/python
'''
DISTRIBUTION STATEMENT A. Approved for public release: distribution unlimited.
This material is based upon work supported by the Assistant Secretary of Defense for
Research and Engineering under Air Force Contract No. FA8721-05-C-0002 and/or
FA8702-15-D-0001. Any opinions, findings, conclusion... |
Details.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2020 Robert Aranha
#
# 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 requ... |
core.py |
__version__ = "0.0.1"
__license__ = "MIT"
__author__ = "deadwind"
import os
import signal
import subprocess
import threading
import shlex
import traceback
"""
目前不支持Windows和Python2
"""
def _terminate_process(process):
os.kill(process.pid, signal.SIGTERM)
def _kill_process(process):
os.kill(process.pid, si... |
local_elastic_agent_test.py | #!/usr/bin/env python3
# Owner(s): ["oncall: r2p"]
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import json
import multiprocessing as mp
import os
import shut... |
web.py | # coding=utf-8
import argparse
from flask import Flask, render_template, request, session, jsonify, Response
import logging
import psutil
import platform
import socket
import os
from datetime import datetime
import time
import threading
import uuid
from log import Logs, LogError
from net import NetIOCounters, get_inter... |
robots_receiver.py | from app import sio, db
from tinydb import where
from tinyrecord import transaction
import threading
import time
import random
class RobotsReceiver:
def __init__(self):
self._thread = threading.Thread(target=self._receive_packet, daemon=True)
def start(self):
self._thread.start()
def _r... |
Slightshow.py | #!/usr/bin/python2
##############################################################################
## Slightshow.py
##
## Copyright 2011 Johannes Marbach. All rights reserved.
## See the LICENSE file for details.
import getopt, os, sys
from random import randint
from threading import Thread
from time import sleep, tim... |
main.py | from flask import Flask, render_template, g, session
from flask_httpauth import HTTPBasicAuth
from flask_script import Manager
from flask_cors import CORS
from datetime import date, datetime
import logging
from time import sleep
import threading
import json
from bson import ObjectId
from config import app_config, save... |
email.py | from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from . import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kwargs):
app = current_app._get_current_object()
msg = Mess... |
train.py | # coding=utf-8
import torch
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
import torch.multiprocessing as mp
from bert import BERTLM
from data import Vocab, DataLoader, CLS, SEP, MASK
from adam import AdamWeightDecayOptimizer
import argparse, os
import random
def parse_config... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.