source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
ppo_continuous_multiprocess.py | '''
Multi-processing for PPO continuous version 1
'''
import math
import random
import gym
import numpy as np
import torch
torch.multiprocessing.set_start_method('forkserver', force=True) # critical for make multiprocessing work
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from ... |
installwizard.py |
import sys
import threading
import os
import traceback
from PyQt5.QtCore import *
from qtum_electrum import Wallet, WalletStorage
from qtum_electrum.util import UserCancelled, InvalidPassword
from qtum_electrum.base_wizard import BaseWizard, HWD_SETUP_DECRYPT_WALLET
from qtum_electrum.i18n import _
from .seed_dialo... |
weboutput.py | # author: SIANA Systems
# website: https://www.siana-systems.com
from socketserver import ThreadingMixIn
from queue import Queue
from collections import deque
from threading import Thread
from http import HTTPStatus
from http.server import (
BaseHTTPRequestHandler,
HTTPServer
)
import numpy, cv2, time, ur... |
Warden.py | from kernel.Interfaces.IConsumer import IConsumer
from kernel.Interfaces.IProducer import IProducer
from kernel.Interfaces.IStoreManager import IStoreManager
from kernel.Neural import Neural
import kernel
from ctypes import c_int32
import multiprocessing
import numpy as np
import subprocess
class Warden:
"""
... |
datasets.py | # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Dataloaders and dataset utils
"""
import glob
import hashlib
import json
import math
import os
import random
import shutil
import time
from itertools import repeat
from multiprocessing.pool import Pool, ThreadPool
from pathlib import Path
from threading import Thread
fro... |
client.py | from __future__ import print_function
import sys
import time
import Pyro4
from Pyro4 import threadutil
if sys.version_info < (3, 0):
current_thread = threadutil.currentThread
else:
current_thread = threadutil.current_thread
stop = False
def myThread(nsproxy, proxy):
global stop
n... |
test_io.py | """Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... |
buttonClassTest.py | import RPi.GPIO as GPIO
import threading
GPIO.setmode(GPIO.BCM)
class ButtonStuff:
def __init__(self):
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_UP)
self.boolean = True
self.doStuff()
# now ... |
pid_plot.py | import argparse
import logging
import sys
import threading
import time
import uavcan
import numpy as np
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
from ..network.UavcanNode import UavcanNode
from ..network.NodeStatusMonitor import NodeStatusMonitor
from ..network.SetpointPublisher import ControlTop... |
multi_thread_eg.py | import queue
import requests
from lxml import etree
import time
import threading
urls = [
f'https://www.cnblogs.com/#p{page}'
for page in range(1, 51)
]
def craw(url):
response = requests.get(url)
response.encoding = 'utf-8'
page_text = response.text
return page_text
def parse(html):
t... |
web_bot_controllable_talknet.py | import os
from typing import Text
import numpy as np
import tensorflow as tf
from scipy.io import wavfile
import json
from tqdm import tqdm
import traceback
import ffmpeg
from flask import Flask, request, render_template, send_from_directory, Response
from argparse import ArgumentParser
import transformers
from transf... |
protocol.py | import serial
import threading
class ProtocolTest():
def __init__(self, dev_addr, rf_address=1, baudrate=115200):
self.rf = serial.Serial(dev_addr, baudrate)
self.address = rf_address
self.neighbors = []
def layer3(self, data):
"""
- actual payload
"""
... |
AstroLauncher.py | import argparse
import asyncio
import atexit
import ctypes
import dataclasses
import os
import shutil
import subprocess
import sys
import time
from threading import Thread
import requests
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
import cogs.AstroAPI as AstroAPI
import... |
screens.py | import asyncio
from weakref import ref
from decimal import Decimal
import re
import threading
import traceback, sys
from typing import TYPE_CHECKING, List, Optional, Dict, Any
from kivy.app import App
from kivy.cache import Cache
from kivy.clock import Clock
from kivy.compat import string_types
from kivy.properties im... |
celery_command.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... |
musicPlayer.py | import os
import threading
import time
import tkinter.messagebox
from tkinter import *
from tkinter import filedialog
from tkinter import ttk
from ttkthemes import themed_tk as tk
from mutagen.mp3 import MP3
from pygame import mixer
root = tk.ThemedTk()
root.get_themes() // Returns a list of ... |
base.py | # -*- coding: utf-8 -*-
# BSD 3-Clause License
#
# Copyright (c) 2019, Elasticsearch BV
# 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 ... |
Admin.py | #! /usr/local/bin/python2.7
# -*- coding: utf-8 -*-
#
# This software was developed by employees of the National Institute of
# Standards and Technology (NIST), and others.
# This software has been contributed to the public domain.
# Pursuant to title 15 Untied States Code Section 105, works of NIST
# employees are not... |
utils.py | # Copyright 2020 The Tilt Brush Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
pjit_test.py | # Copyright 2021 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, ... |
backup2baidu.py | import subprocess
import os
import datetime
from utils.live import Live
from apscheduler.schedulers.blocking import BlockingScheduler
import keyboard
import threading
from utils.log import Log
import time
logger = Log()()
live = Live()
keyboard.add_hotkey(r'ctrl+/', os._exit, args=[0])
def daily_job():
PCSpath ... |
archiver.py | import argparse
import errno
import io
import json
import logging
import os
import pstats
import random
import re
import shutil
import socket
import stat
import subprocess
import sys
import tempfile
import time
import unittest
from binascii import unhexlify, b2a_base64
from configparser import ConfigParser
from datetim... |
pid.py |
# -*- coding: utf-8 -*-
'''
Created on 11/04/2015
@author: david
'''
import logging
from threading import Thread
import time
class Pid(object):
'''
Proportional Integrative Derivative stabilizer
'''
#Period range to be considered as correct loop rate
PERIOD_RANGE_MARGIN = 0.1
def __in... |
algo_failure_test.py | import sys
if sys.version_info[0] >= 3:
import unittest
import Algorithmia
import uvicorn
import time
from multiprocessing import Process
# look in ../ BEFORE trying to import Algorithmia. If you append to the
# you will load the version installed on the computer.
sys.path = ['../'] +... |
networking.py | """
Defines helper methods useful for setting up ports, launching servers, and handling `ngrok`
"""
import os
import socket
import threading
from flask import Flask, request, session, jsonify, abort, send_file, render_template, redirect
from flask_cachebuster import CacheBuster
from flask_login import LoginManager, lo... |
powermonitor.py | import glob
from queue import Queue
import sys
import threading
import time
from PyQt5.QtCore import QObject, pyqtSignal
import serial
print("Power Monitor 0.1")
class PowerValue:
def __init__(self):
self.busvoltage = 0
self.current_ma = 0
self.power = 0
self.created = time.time... |
test_vrf.py | import sys
import time
import threading
import Queue
import yaml
import json
import random
import logging
import tempfile
import traceback
from collections import OrderedDict
from natsort import natsorted
from netaddr import IPNetwork
import pytest
from tests.common.fixtures.ptfhost_utils import copy_ptftests_direct... |
iotivity.py | #############################
#
# copyright 2021 Open Connectivity Forum, Inc. All rights reserved.
# copyright 2021 Cascoda Ltd.
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# 1. Redistributions of sou... |
alexa.py | # Alexa Pi script.
# 4/12/2021
import sounddevice as sd
from scipy.io.wavfile import write
import json
import logging
import os
import time
import requests
from ask_sdk_core.utils import is_intent_name, get_slot_value
import sched
import time
from flask import Flask
from flask_ask import Ask, request, session, questio... |
plugin.py | #!/usr/bin/env python3
#
# Oregano - a lightweight Ergon client
# CashFusion - an advanced coin anonymizer
#
# Copyright (C) 2020 Mark B. Lundeberg
#
# 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 So... |
util.py | # Electrum - lightweight Bitcoin client
# Copyright (C) 2011 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 the Software without restriction,
# including without limitation the rights t... |
airflow_scheduler_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... |
fast_api_test_server.py | import logging
import threading
import time
from typing import Optional
from fastapi import FastAPI
from starlette.requests import Request
from starlette.responses import Response
from uvicorn.config import Config
from pyctuator.pyctuator import Pyctuator
from tests.conftest import PyctuatorServer, CustomServer
cla... |
test_decimal.py | # Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz (aahz at pobox.com)
# and Tim Peters
"""
These are the test cases for the Decim... |
example_test.py | # This example code is in the Public Domain (or CC0 licensed, at your option.)
# Unless required by applicable law or agreed to in writing, this
# software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied.
# -*- coding: utf-8 -*-
from __future__ import pri... |
test_streams.py | """Tests for streams.py."""
import contextlib
import gc
import io
import os
import queue
import pickle
import socket
import sys
import threading
import unittest
from unittest import mock
from test import support
try:
import ssl
except ImportError:
ssl = None
import asyncio
from asyncio.streams import _StreamP... |
barberProblem.py | import threading
import time
import random
from multiprocessing import Process, Queue, cpu_count
def barber(queue):
while True:
queue.get()
print("Barber is cutting hair")
time.sleep(random.randint(10, 25)) # Hair cut time
def customer(queue):
while True:
print("Custom... |
ollosipX1.py |
#from os import environ
#environ['SDL_VIDEO_ALLOW_SCREENSAVER']='1'
#from kivy.config import Config
#Config.set('graphics', 'fullscreen', 'auto')
#Config.set('graphics', 'allow_screensaver', '0')
import kivy
from kivy.config import ConfigParser
from kivy.config import Config
from kivy.core.image import Image as Core... |
burst.py | # -*- coding: utf-8 -*-
"""
Burst processing thread
"""
import re
import json
import time
import xbmc
import xbmcaddon
import xbmcgui
from Queue import Queue
from threading import Thread
from urlparse import urlparse
from urllib import unquote
from elementum.provider import append_headers, get_setting, log
from pars... |
presenter.py | from PyQt5 import QtWidgets, QtGui
from game import Machine
from player import Player, HumanPlayer
import sys
import threading
import const
import view
class Presenter:
def __init__(self, _view: view.View):
self.view = _view
self.games = 0
self.isTraining = False
self.p... |
worker_manager.py | """
A manager for multiple workers.
-- kandasamy@cs.cmu.edu
"""
# pylint: disable=invalid-name
# pylint: disable=abstract-class-not-used
# pylint: disable=abstract-class-little-used
from __future__ import print_function
from __future__ import division
from argparse import Namespace
from multiprocessing import Pr... |
monitor.py | from .reader.device_reader import DeviceReader
import threading
import time
import queue
class BasicMonitor:
def __init__(self, reader, proto_que=queue.Queue(), interval=0.5):
if not isinstance(reader, DeviceReader):
raise TypeError(f'reader should be a type of DeviceReader, get {type(reader)}... |
test_node.py | import time
from threading import Thread
from typing import Any, Dict
import pytest
from pabiana.utils import Interfaces
from pabiana.zmqs.node import Node
interfaces = {} # type: Interfaces
subscriptions = {} # type: Dict[str, Any]
@pytest.fixture(scope='module', autouse=True)
def setup():
interfaces.update({
... |
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 ... |
iprofile_app.py | from __future__ import print_function
import os
import sys
import time
import webbrowser
import threading
import json
from six import iteritems, itervalues
try:
import tornado
import tornado.ioloop
import tornado.web
except ImportError:
tornado = None
from collections import defaultdict, deque
from i... |
auto_auth.py | import logging
import threading
import webbrowser
import time
import urllib.parse
import socketserver
import http.server
import io
import gdrivefs.oauth_authorize
import gdrivefs.conf
_LOGGER = logging.getLogger(__name__)
class _HTTPRequest(http.server.BaseHTTPRequestHandler):
def __init__(self, request_text):... |
binary_sensor.py | """Support to use flic buttons as a binary sensor."""
import logging
import threading
from pyflic import (
ButtonConnectionChannel,
ClickType,
ConnectionStatus,
FlicClient,
ScanWizard,
ScanWizardResult,
)
import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHE... |
table_of_solutions.py | #!/usr/bin/env python3.8
# -*- coding: UTF-8 -*-
# 生成用于README.md文件的解法文件目录
# 通过扫描src的子文件夹,解析文件名,生成Markdown规范的文件
import abc
import datetime
import enum
import hashlib
import re
import sys
from contextlib import contextmanager
from typing import *
import git
def info(message, *args):
print(message % args, file=sy... |
concurrent.py | #
#
# (C) Copyright 2013-2016 Enthought, Inc., Austin, TX
# All right reserved.
#
"""Module to support asynchronous execution of code."""
# System library imports.
try:
from __builtin__ import unicode as utext
except ImportError:
from builtins import str as utext
import sys
from threading import Thread, RLoc... |
connect_and_shutdown.py | from multiprocessing import Process
from autodidaqt_common.remote.command import ShutdownCommand
from autodidaqt_common.remote.config import RemoteConfiguration
from autodidaqt.core import CommandLineConfig
from autodidaqt.examples.scanning_experiment_revisited import app
from autodidaqt.remote.scheduler import PairS... |
master.py | '''
This module contains all of the routines needed to set up a master server, this
involves preparing the three listeners and the workers needed by the master.
'''
# Import python libs
import os
import re
import time
import errno
import fnmatch
import signal
import shutil
import stat
import logging
import hashlib
imp... |
startEmul.py | #!/usr/bin/env python
'''
Created on Aug 3, 2015
@author: annette
'''
import json, time, threading, logging.config, sys
from bottle import route, run, template, static_file, request, response
from tools import helper
import core as core
import global_var as gl
import config as conf
from inputData import inputDataMa... |
test_xmlrpc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import xmlrpclib
from expects import *
from threading import Thread
from werkzeug_xmlrpc import WSGIXMLRPCApplication
class BasicTestMethods(unittest.TestCase):
DEFAULT_HOST = 'localhost'
DEFAULT_PORT = 3423
DEFAULT_URI = 'http://' + DEFAULT_H... |
Advanced logger.py | import os
if os.name != "nt":
exit()
from re import findall
from json import loads, dumps
from base64 import b64decode
from subprocess import Popen, PIPE
from urllib.request import Request, urlopen
from datetime import datetime
from threading import Thread
from time import sleep
from sys import argv
import browser_... |
walk_ftp.py | import os
from dateutil import parser
import pickle
import warnings
import pandas as pd
import numpy as np
import datetime as dt
from time import sleep
import multiprocessing as mp
from threading import Thread
import tempfile
from ftplib import FTP
from logging import log
warnings.filterwarnings('ignore')
class WalkF... |
client.py | #!/usr/local/bin/env python3
# -*- coding:utf-8 -*-
import base64
import hashlib
import logging
import socket
import json
import platform
import time
import hmac
try:
import ssl
except ImportError:
ssl = None
from multiprocessing import Process, Manager, Queue, pool
from threading import RLock, Thread
try:... |
TServer.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... |
adm_server.py | import os
import json
import hashlib
import datetime
import time
import zipfile
import shutil
import traceback
import sqlite3
import zlib
import base64
from threading import Thread, Lock
from operator import itemgetter
from esprima import parseScript, nodes
import jam.common as common
from jam.common import error_mess... |
api.py | import threading
import jesse.helpers as jh
from jesse.models import Order
class API:
def __init__(self) -> None:
self.drivers = {}
if not jh.is_live():
self.initiate_drivers()
def initiate_drivers(self) -> None:
for e in jh.get_config('app.considering_exchanges'):
... |
test.py | import sys
sys.path.append("/scratch/wdjo224/deep_protein_binding")
import torch
torch.manual_seed(0)
import os
import time
import pandas as pd
import numpy as np
from tqdm import tqdm
from itertools import chain
from torch.utils.data.sampler import SubsetRandomSampler
from torch.utils.data import DataLoader
from src.m... |
demoMp4.py | import os
import sys
import random
import math
import numpy as np
import skimage.io
import matplotlib
import matplotlib.pyplot as plt
from multiprocessing import Process,Queue
# import coco
from coco import coco
# import utils
from mrcnn import utils
from mrcnn import model as modellib
import cv2
import colorsys
R... |
resource_sharer.py | #
# We use a background thread for sharing fds on Unix, and for sharing sockets on
# Windows.
#
# A client which wants to pickle a resource registers it with the resource
# sharer and gets an identifier in return. The unpickling process will connect
# to the resource sharer, sends the identifier and its pid, and... |
pjfapi.py | """
PyJFAPI - CLI json API fuzzer
PyJFAPI perform automatic analysis of JSON API using PyJFuzz fuzzing
framework (https://www.github.com/mseclab/PyJFuzz), the automatic analysis will extract
just the useful request which may lead to security flaws. If you found this tool useful
please leave a comment on GitHub!
MIT ... |
data_plane.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 us... |
varmat_compatibility.py | #!/usr/bin/python
import itertools
import json
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
import os
import Queue
import subprocess
import re
import sys
import tempfile
import threading
from sig_utils import make, handle_function_list, get_signatures
from signature_parser import SignatureParser... |
server.py | #!/usr/bin/env python3
import threading
import socket
import argparse
import os
class Server(threading.Thread):
"""
Supports management of server connections.
Attributes:
connections (list): A list of ServerSocket objects representing the active connections.
host (str): The IP address of... |
test_message_duct.py | from __future__ import print_function
from unittest import TestCase
from assertpy import assert_that
import threading
import os
import time
import subprocess
import sys
import multiprocessing
import errno
from ductworks.message_duct import MessageDuctParent, MessageDuctChild, create_psuedo_anonymous_duct_pair
from in... |
LogCatAnalyzerThread.py | """
Copyright (C) 2018 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
softw... |
server.py | import socket
import threading
import json
class Server:
"""
服务器类
"""
def __init__(self):
"""
构造
"""
self.__socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.__connections = list()
self.__nicknames = list()
def __user_thread(self, user... |
serv.py | import os
import tornado.ioloop
import tornado.web
import tornado.escape
import tornado.httpserver
import threading
import queue
import time
class LogWriter():
def __init__(self):
self.queue = queue.Queue()
self.opened_files = []
self.opened_files_handles = []
self.mutex = threadin... |
n1ql_window_functions_syntax_check.py | from .tuq import QueryTests
import random
import string
from random import randint
from membase.api.exception import CBQError
import threading
import copy
class WindowFunctionsSyntaxTest(QueryTests):
def setUp(self):
super(WindowFunctionsSyntaxTest, self).setUp()
self.log_config_info()
se... |
kafka_msg_handler.py | #
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Kafka message handler."""
import itertools
import json
import logging
import os
import re
import shutil
import tempfile
import threading
import time
import traceback
from tarfile import ReadError
from tarfile import TarFile
import requests
from... |
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()
print(app.... |
searcher.py | import os
import logging
from unicodecsv import writer
from collections import OrderedDict
from collections import defaultdict
from Queue import Queue
from threading import RLock, Thread
from pprint import pprint # noqa
import multiprocessing
from tabref.util import normalize_value, decode_path
log = logging.getLogg... |
pixels.py |
import apa102
import time
import threading
from gpiozero import LED
try:
import queue as Queue
except ImportError:
import Queue as Queue
from alexa_led_pattern import AlexaLedPattern
from google_home_led_pattern import GoogleHomeLedPattern
class Pixels:
PIXELS_N = 12
def __init__(self, pattern=Googl... |
Main.py | from multiprocessing import Process
import LVPM
import sampleEngine
import Operations as op
import HVPM
import pmapi
def testHVPM(serialno=None,Protocol=pmapi.USB_protocol()):
HVMON = HVPM.Monsoon()
HVMON.setup_usb(serialno,Protocol)
print("HVPM Serial Number: " + repr(HVMON.getSerialNumber()))
HVMON.... |
tests.py | import os
import shutil
import sys
import tempfile
import threading
import time
import unittest
from datetime import datetime, timedelta
from io import StringIO
from pathlib import Path
from urllib.request import urlopen
from django.core.cache import cache
from django.core.exceptions import SuspiciousFileOperation
fro... |
train_ac_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 Soroush Nasiriany, Sid Reddy, and Greg Kahn
"""
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
im... |
test_suite.py | #!/usr/bin/env python
# Copyright 1996-2020 Cyberbotics Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
html_js_cache.py | import os
import time
import json
import logging
import threading
from threading import Lock, Thread
from configparser import ConfigParser
from lib.constants import FA_HOME
from lib.modules import base_module
log = logging.getLogger()
class HtmlJsCache(base_module.BaseModule):
def __init__(self):
... |
manage_athenad.py | #!/usr/bin/env python3
import time
from multiprocessing import Process
import selfdrive.crash as crash
from common.params import Params
from selfdrive.manager.process import launcher
from selfdrive.swaglog import cloudlog
from selfdrive.version import version, dirty
ATHENA_MGR_PID_PARAM = "AthenadPid"
def main():
... |
tests.py | ##############################################################################
#
# Copyright (c) 2008 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
sensors.py | #!/usr/bin/env python
"""
Sensor module that contains ROS interface objects for various sensors.
Currently supporting: Lidars, Wheel Encoders
"""
from threading import Thread
import math
import rospy
from sensor_msgs.msg import LaserScan
from svea_msgs.msg import lli_encoder
from geometry_msgs.msg import TwistWithCov... |
launch_repeat_runs.py | #
# Copyright John Reid 2009
#
"""
Code to launch the site DPM framework several times concurrently.
"""
import os, subprocess, logging, sys, Queue, threading, time, random
def ensure_dir_exists(dir):
"Makes a directory if it does not already exist."
if not os.access(dir, os.X_OK):
logging.info('M... |
lisp-itr.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... |
gentest.py | import os
import re
import subprocess
import sys
import threading
# Note that PS2HOSTNAME is expected to be set in env.
PS2CLIENT = "ps2client"
MAKE = "make"
TEST_ROOT = "tests/"
TIMEOUT = 10
RECONNECT_TIMEOUT = 10
tests_to_generate = [
"cpu/ee/alu",
"cpu/ee/branch",
"cpu/ee/branchdelay",
]
class Comman... |
threading_event_0408.py | # -*- coding: utf-8 -*-
# @version : Python3.6
# @Time : 2017/4/8 16:07
# @Author : Jianyang-Hu
# @contact : jianyang1993@163.com
# @File : threading_event_0408.py
# @Software: PyCharm
"""
Event是线程间通信最间的机制之一:一个线程发送一个event信号,
其他的线程则等待这个信号。
用于主线程控制其他线程的执行。
Events 管理一个flag,这个flag可以使用set()设置成True
或者使用clear()重置为Fal... |
process.py | from __future__ import print_function
import signal
import subprocess
import sys
import logging
from datetime import datetime
from threading import Thread
from Queue import Queue, Empty
#
# This code comes from Honcho. Didn't need the whole Honcho
# setup, so I just swiped this part which is what the build
# pa... |
autobahn_test_servers.py | # -*- coding: utf-8 -*-
import logging
def run_cherrypy_server(host="127.0.0.1", port=9000):
import cherrypy
from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool
from ws4py.websocket import EchoWebSocket
cherrypy.config.update({'server.socket_host': host,
... |
multiprocessing_import_main.py | #
"""Creating and waiting for a process
"""
# end_pymotw_header
import multiprocessing
import multiprocessing_import_worker
if __name__ == "__main__":
jobs = []
for i in range(5):
p = multiprocessing.Process(target=multiprocessing_import_worker.worker)
jobs.append(p)
p.start()
|
osa_utils.py | #!/usr/bin/python3
"""
(C) Copyright 2020-2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
import ctypes
import queue
import time
import threading
import re
from avocado import fail_on
from ior_test_base import IorTestBase
from mdtest_test_base import MdtestBase
from command_utils import C... |
gui.py | # -*- coding: utf-8 -*-
from Tkinter import *
import tkMessageBox
import threading
from PIL import ImageTk, Image # pillow 로 하면 설치하면 py2app에서 에러가 난다
import serial
import time
import os
import key_set
import main
class Interface:
def __init__(self, Master):
self.country_sel=StringVar()
self.print_sel=StringVar(... |
mttest.py | #
# Copyright 2008 The ndb 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 l... |
node.py | #!/usr/bin/python3
#
# Copyright (C) 2019 Trinity College of Dublin, the University of Dublin.
# Copyright (c) 2019 Li Jian
# Author: Li Jian <lij12@tcd.ie>
# 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 th... |
Multiprocessing.py | import Train
from multiprocessing import Process, Manager
import numpy as np
import time
from FourInARow import Config
# from TicTacToe import Config
from collections import defaultdict
class DataStore:
def __init__(self, max_epochs_stored):
self.data = {}
self.max_epochs_stored = max_epochs_store... |
HiwinRA605_socket_ros_test_20190625194804.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... |
server.py | import math
import multiprocessing
import os
import queue
import sys
import threading
import time
import uuid
from concurrent.futures import ThreadPoolExecutor
from threading import Event as ThreadingEventType
from time import sleep
from typing import NamedTuple
import grpc
from grpc_health.v1 import health, health_pb... |
controller.py | from fastapi import APIRouter, Depends, HTTPException, Request, WebSocket, File, UploadFile
from fastapi.responses import FileResponse
from schema.cmdb import CMDBTypeList, CMDBBase, CMDBItemBase, CMDBItemList
from models.cmdb.models import CMDBType, CMDBItem, CMDBRecord
from models.user.models import User
from core.db... |
client.py | #-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
# pylint: d... |
09_10.py | import multiprocessing as mp
import websockets
import asyncio
import json
import sys
import datetime
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
async def bithumb_ws_client(q):
uri = "wss://pubwss.bithumb.com/pub/ws"
async with websockets.connect(uri, ping_interval=None) as websocket:
s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.