source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
runOsci.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Data visualisation
this script reads data from PicoScope
and displays them in oscilloscope mode
Usage: ./runOsci.py <Oscilloscope_config>.yaml
"""
from __future__ import print_function, division, unicode_literals
from __future__ import absolute_import
... |
interface-obdii-to-android.py | import threading
import time
import math
import datetime
import json
import argparse
import sys
import random
from collections import namedtuple
from diagnostic_sensors import DIAGNOSTIC_SENSOR_FLOAT_CALCULATED_ENGINE_LOAD
from diagnostic_sensors import DIAGNOSTIC_SENSOR_FLOAT_ENGINE_COOLANT_TEMPERATURE
from diagnosti... |
crawler.py | # encoding: utf-8
import requests
from multiprocessing import Process, Queue
from urlparse3 import parse_url
from bs4 import BeautifulSoup
class Crawler(object):
def __init__(self, url):
self.url = parse_url(url)
self.response = self.body_parser(self.check_status_code())
self.resources =... |
translate_dataset_singlecore.py | from argparse import Namespace
from tornado import process
from shlex import quote
import websocket
from websocket import WebSocket
from content_processor import ContentProcessor
from typing import List
import argparse
from tqdm import tqdm
import multiprocessing as mp
import time
def blocks(files, size=65536):
w... |
app.py | """
Embed bokeh server session into a flask framework
Adapted from bokeh-master/examples/howto/serve_embed/flask_gunicorn_embed.py
"""
import time
import asyncio
import logging
from threading import Thread
import requests
from flask import Flask, render_template, request, Response
from flask_cors import CORS,... |
humidity-sensor.py | from connection import *
import connection, threading, socket
from datetime import datetime
value = -1
humidityTimes = {}
with open(SOURCE_FILE, mode='r+') as csv_file:
for row in csv_file:
if (row.split(',')[3] == '\n'):
humidityTimes[row.split(',')[1]] = 'error'
continue
... |
test_extending.py | import math
import operator
import sys
import pickle
import multiprocessing
import ctypes
import warnings
from distutils.version import LooseVersion
import re
import numpy as np
from numba import njit, jit, vectorize, guvectorize, objmode
from numba.core import types, errors, typing, compiler, cgutils
from numba.core... |
testing_utils.py | """
weasyprint.tests.testing_utils
------------------------------
Helpers for tests.
"""
import contextlib
import functools
import logging
import os.path
import sys
import threading
import wsgiref.simple_server
from weasyprint import CSS, HTML
from weasyprint.logger import LOGGER
from weasyprint.urls im... |
utils.py | # -*- encoding: utf-8 -*-
# Copyright 2015 - Alcatel-Lucent
# Copyright © 2014-2015 eNovance
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
#
# Licensed under the Apache License, Version 2.0 (the... |
Wallet.py | #!/usr/bin/env python3
##########################################
# Duino-Coin Tkinter GUI Wallet (v2.45)
# https://github.com/revoxhere/duino-coin
# Distributed under MIT license
# © Duino-Coin Community 2019-2021
##########################################
import sys
from base64 import b64decode, b64encode
fr... |
common.py | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Python
from datetime import timedelta
import json
import yaml
import logging
import os
import subprocess
import re
import stat
import urllib.parse
import threading
import contextlib
import tempfile
from functools import reduce, wraps
# Django
from django.cor... |
apievaluation.py | import random
from threading import Thread
import time
import shutil
import settings
import os
from apitools import tools
TEST_IMAGES_DIR = os.path.join(settings.ROOT_DIR, "tests/res/images")
def initiate_test(noImages, mode, isDirectory):
if isDirectory:
json_result = get_API_results(images_number=noIm... |
_process_manager.py | from collections import deque
import subprocess
import traceback
import sys
from threading import Thread
try:
from queue import Queue, Empty
except ImportError:
from Queue import Queue, Empty # python 2.x
from nanome._internal._process import _ProcessEntry
from nanome.util import Logs, IntEnum, auto
POSIX = ... |
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... |
video_stream.py | from threading import Thread
from typing import Callable, List, Tuple, Any
from time import time
import cv2
import numpy as np
CALLBACK_TYPE = Callable[[Tuple[np.ndarray, float]], Any]
class Capture:
"""
Calls a list of callbacks with a tuple of (frame, timestamp), with the
frame in BGR format.
"""
... |
test_multitask.py | import sys
import threading
from niveristand import nivs_rt_sequence, NivsParam
from niveristand import realtimesequencetools
from niveristand.clientapi import I32Value
from niveristand.clientapi import RealTimeSequence
from niveristand.errors import TranslateError, VeristandError
from niveristand.library import multit... |
utils.py | import time
import subprocess
from collections import namedtuple,defaultdict
import logging
import json
import os
import yaml
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import sys
import threading
def loadTensorBoard(outdir):
t = threading.Thread(target=launchTensorBoard,... |
__init__.py | #!/usr/bin/python3
# @todo logging
# @todo extra options for url like , verify=False etc.
# @todo enable https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl as option?
# @todo option for interval day/6 hour/etc
# @todo on change detected, config for calling some API
# @todo fetch title into json
# https://di... |
test_nogil.py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import time
import pytest
import os
import io
from threading import Thread
import numpy as np
from openvino.runtime import Core, Model, AsyncInferQueue, PartialShape, Layout, opset8 as ops, serialize
from openvin... |
app.py | # encoding: utf-8
"""
A REST API for Salt
===================
.. py:currentmodule:: salt.netapi.rest_cherrypy.app
:depends:
- CherryPy Python module.
Note: there is a `known SSL traceback for CherryPy versions 3.2.5 through
3.7.x <https://github.com/cherrypy/cherrypy/issues/1298>`_. Please use
... |
anki-voice.py | __version__ = "0.3"
__author__ = "William Knowles (@william_knows)"
import argparse
from enum import Enum
import json
import logging
import os
from pathlib import Path
import pyaudio
import pyttsx3
import queue
import requests
import sys
import time
import threading
from vosk import Model, KaldiRecognizer, SetLogLevel... |
run.py | import threading
from fastspider.config import downloader_in_queue_local, downloader_out_queue_local
from fastspider.core.downloader.requestsdownloader import RequestDownloader
from loguru import logger
def run_local_downloader():
r = RequestDownloader(downloader_in_queue_local, downloader_out_queue_local)
r... |
thread_manager.py | # standard python package
import configparser
import threading
import time
# local packages
from crawler import WebCrawler
from fetcher import LinkFetcher
class ThreadManager:
def __init__(self):
""" Constructor for Thread Manager of Web Crawler. """
self.config = ThreadManager.__read_config()
... |
Cron.py | from threading import Thread
from time import sleep
import Settings
import subprocess
from Email import Email
from DbConnection import DbConnection
from Voice import Voice
def ffmpeg(media_in, media_out, id_num, path_out, email, tittle, name):
output = subprocess.call(['ffmpeg', '-i', media_in,
... |
labels.py | import hashlib
import requests
import threading
import json
import sys
import traceback
import base64
import electrum_dongri as electrum
from electrum_dongri.plugins import BasePlugin, hook
from electrum_dongri.i18n import _
class LabelsPlugin(BasePlugin):
def __init__(self, parent, config, name):
Base... |
taskfarm.py | '''
Created on Jul 4, 2013
@author: Vlad & Bert
'''
from threading import Thread
from collections import deque
import os
import sys
import time
import random
import submit_a_task
import get_run_time
import xmltodict
import pprint
pp = pprint.PrettyPrinter(indent=4,stream=sys.stderr)
class Error(Ex... |
test_dataloader.py | # Owner(s): ["module: dataloader"]
import math
import sys
import errno
import multiprocessing
import os
import ctypes
import faulthandler
import torch
import gc
import time
import signal
import unittest
import itertools
import warnings
import tempfile
from torch import multiprocessing as mp
from torch.utils.data impor... |
test_operator.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... |
EC2startStop.py | """
The EC2 monitor CLI
Monitors all EC2 instances related to an account.
The connect command will invoke the SSH command or the RDP application.
"""
import os
import sys
import time
import threading
import re
import click
import arrow
from utils import SEP, GlobalState, get_client, cover
global_state = GlobalState()... |
mistyPy.py | import requests
import json
import threading
import time
import websocket
try:
import thread
except ImportError:
import _thread as thread
from random import*
class Robot:
def __init__(self,ip):
self.ip = ip
self.images_saved = []
self.audio_saved = []
self.faces_saved = [... |
app.py | # encoding: utf-8
'''
A REST API for Salt
===================
.. versionadded:: 2014.7.0
.. py:currentmodule:: salt.netapi.rest_cherrypy.app
:depends: - CherryPy Python module. Versions 3.2.{2,3,4} are strongly
recommended due to a known `SSL error
<https://bitbucket.org/cherrypy/cherrypy/issue/1298/ssl-no... |
trainer.py | # Copyright (c) 2020 Fellow Consulting AG
#
# 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
# to use, copy, modify, merge, publish... |
shell_fs.py |
__copyright__ = "Copyright 2013-2016, http://radical.rutgers.edu"
__license__ = "MIT"
import os
import threading
import subprocess as sp
import radical.utils as ru
from ... import agent as rpa
from ... import states as rps
from ... import constants as rpc
from .base import AgentExecutingComponent
# ... |
trivia.py | #!/usr/bin/env python
"""
"""
from hon.packets import ID
import time
import os
import pickle
import threading
import sys
from random import randint
class Trivia:
def __init__(self, bot):
self.bot = bot
self.thread = None
self.current = {}
self.high_score = 5
self.scores = {}
self.questions = []
self.us... |
main.py | import os, threading, argparse, logging, signal
from flask import Flask, send_file, redirect, request
from time import sleep
from Crypto.Cipher import ARC4
ENC_FILE_NAME = 'dropper_sc_enc.bin' #Name of the file containing RC4 encrypted shellcode
INVALID_REDIR = 'https://google.com' #URL of a website where invalid req... |
server.py | #!/usr/bin/python3
import socket
import threading
import sys
import signal
class Server:
def handler(signum,f):
print(signum)
sys.exit()
signal.signal(signal.SIGINT,handler)
def __init__(self):
self.ip = "10.21.20.55"
while 1:
try:... |
minitouch.py | from variable import GlobalVar
from multiprocessing import Process, Lock, Event, Queue
import time, math
from pyminitouch import safe_connection, safe_device, MNTDevice, CommandBuilder
class XY(object):
def __init__(self, x, y):
self._x = (int)(x)
self._y = (int)(y)
def get_x(self):
r... |
mock_pyudev.py | #Copyright 2013 Pieter Rautenbach
#
# 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 writin... |
coin.py | import time
from threading import Thread
from PyQt5.QtCore import QObject, pyqtSignal
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QGraphicsPixmapItem
from client.constants import IMAGES_DIR
class Coin(QObject):
draw_signal = pyqtSignal(int, int)
remove_signal = pyqtSignal()
animate_signal ... |
0_3_threading_Thread_func_args.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Time : 2020-11-06
@Author : EvilRecluse
@Contact : https://github.com/RecluseXU
@Desc : 线程 传参运行传入函数
'''
# here put the import lib
import threading
def helloworld(arg1, arg2, arg3):
print(arg1, arg2, arg3)
if __name__ == '__main__':
t = thr... |
udp2amqp.py | #!/usr/bin/python
import argparse
import time
import calendar
import logging
import pika
import threading
import queue
import sys
import socket
from pika.exceptions import AMQPConnectionError
class ProducerBroker(object):
exchange = 'posrep-raw'
exchange_type = 'fanout'
routing_key = None
def __init... |
serial_plot.py | #!/usr/bin/env python3
#
# Pavel Kirienko, 2016 <pavel.kirienko@gmail.com>
#
# This is a quick hack that allows to plot values from serial port and at the same time have access to CLI.
# This script may be superseded with Zubax Toolbox at some point.
#
import numpy
import os
import sys
import threading
import time
imp... |
support.py | """ This uses the python libraries to build up the front end of this app
AUTHOR - SOURAV MODAK
DATE - 19 NOV 2020
INDIA
"""
import tkinter as tk
from tkinter import *
import webbrowser
from unittest.mock import call
from googlesearch import search
from tkinter.ttk import *
from get_webpages import *
from threading i... |
FastANIServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, Inva... |
multiprocessing_issue3.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, config_path="multiprocessing_issue3_config.yaml")
def worker(arg):
... |
atcmd.py |
"""
负责串口交互,Modem交互
使用:
# 打开modem
s = ATModemCmd('COM9', 115200)
# 配置来电显示callback函数
s.notify_conf([CID_KEY_NUMBER], test_incoming_call)
s.callout('电话号码字符串')
来电显示callback函数接受一个参数,type: CIDData()。读取 CIDData.cid_number 即可获取来电显示号码
注意:使用了多线程,使用Python内置的SQLite需要注意。
# modem交互/调试方法
可以使用PuTTY等软件打开modem COM... |
client.py | import socket
import sys
import struct
import time
import io
import numpy as np
import cv2
from queue import Queue
import threading
class Client(threading.Thread):
def __init__(self, identifier, ip='192.168.178.150'):
super().__init__()
self.running = True
self.client_socket = socket.socke... |
vienna.py | #!/usr/bin/env python3
'''
Responsible for running
'''
import os
import re
import sys
import logging
from typing import Dict, List
from subprocess import Popen, PIPE, DEVNULL
from threading import Thread
from queue import Queue
RNAFOLD_EXE = "RNAfold"
INVERSE_EXE = "RNAinverse"
RES_MATCHER = re.compile(r'(?P<structu... |
webcam.py | # Copyright 2017 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 applicab... |
vis.py | import clr
clr.AddReference("Renode-peripherals")
clr.AddReference("IronPython.StdLib")
import os
import SimpleHTTPServer
import SocketServer
from threading import Thread
import base64
import tempfile
from Antmicro.Renode.Peripherals.Miscellaneous import LED
from Antmicro.Renode.Peripherals.Sensors import ArduCAMMini... |
error_handling.py | # Copyright 2018 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_client.py | #!/usr/bin/env python3
# Copyright: 2017, CCX Technologies
"""Test the method wrapper and decorators."""
import unittest
import typing
import asyncio
import random
import string
import time
from multiprocessing import Process
import adbus
service_name = 'adbus.test'
object_path = '/adbus/test/Tests1'
object_interfa... |
github.py |
import json
import hmac, hashlib
import threading
import http, http.server
from halibot import HalModule, Message
def make_issues_report(event, payload):
title = payload['issue']['title']
user = payload['sender']['login']
repo = payload['repository']['full_name']
if payload['action'] == 'opened':
return 'New i... |
main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Main web application
"""
from __future__ import division, print_function, unicode_literals, absolute_import
# std lib
import os
import sys
from collections import OrderedDict
import functools
from functools import wraps
import glob
import re
import json
from datetime i... |
mttest.py | """A torture test to ferret out problems with multi-threading."""
import sys
import threading
from ndb import tasklets
from ndb import eventloop
def main():
##sys.stdout.write('_State.__bases__ = %r\n' % (eventloop._State.__bases__,))
num = 10
try:
num = int(sys.argv[1])
except Exception:
pass
thr... |
logging_example.py | '''
source: https://docs.python.org/3/howto/logging-cookbook.html#logging-cookbook
Author: Vinay Sajip <vinay_sajip at red-dove dot com>
'''
import logging
import logging.config
import logging.handlers
from multiprocessing import Process, Queue, Event, current_process
import os
import random
import time
class... |
settings_20210906112149.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... |
parallel.py | from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import operator
import sys
from threading import Semaphore
from threading import Thread
from docker.errors import APIError
from six.moves import _thread as thread
from six.moves.queue import Empty
from six.moves.queue import... |
Server.py | import socket
import threading
import time
import ctypes
import platform
import random
if platform.system() == 'Windows':
kernel32 = ctypes.windll.kernel32
kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)
print_mode = False
COMMANDS = {
# Lables
'info': (33, '[!] '),
'que': (34,... |
main.py | import argparse
import github3
import toml
import json
import re
from . import utils
import logging
from threading import Thread, Lock
import time
import traceback
import sqlite3
import requests
from contextlib import contextmanager
from itertools import chain
from queue import Queue
import os
import subprocess
from .g... |
lambda_api.py | #!/usr/bin/env python
from __future__ import print_function
import os
import re
import sys
import json
import uuid
import time
import traceback
import logging
import base64
import threading
import imp
import glob
from io import BytesIO
from datetime import datetime
from multiprocessing import Process, Queue
from six i... |
display.py | from threading import Thread
from animation import Animation, HourAnimation, DateAnimation, TextAnimation
class Display(object):
def __init__(self, debug: bool = False):
self.current_thread = None
self.hour_animation = HourAnimation(debug)
self.date_animation = DateAnimation(debug)
... |
bruteforceAction.py | '''
Brute Force Agent Actions.
'''
import sys,os
import re, random
from furl import *
from urllib.parse import urlparse
import time, signal
from multiprocessing import Process
import stomp
import re
from daemonize import Daemonize
from os.path import basename
current_dir = os.path.basename(os.getcwd())
if current_dir... |
Week06_Task01.py | import socket
import threading
from collections import OrderedDict
class MetricsServer:
def __init__(self, host, port):
self.sock = socket.socket()
self.sock.bind((host, port))
self.sock.listen()
self.threads = []
self.connections = []
self.metrics = {}
self.... |
test_events.py | """Tests for events.py."""
import collections.abc
import concurrent.futures
import functools
import io
import os
import platform
import re
import signal
import socket
try:
import ssl
except ImportError:
ssl = None
import subprocess
import sys
import threading
import time
import errno
import unittest
from unitt... |
client4.3.py | import socket
import threading
name = input("put your name: ")
conn = socket.socket()
conn.connect(('127.0.0.2', 59498))
def run():
while True:
message = conn.recv(16384).decode("utf-8")
if message == 'name':
conn.send(name.encode('utf-8'))
else:
print(message)
de... |
command_output.py | #!/usr/bin/python2.4
# Copyright 2009, Google Inc.
# 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... |
simulation_2.py | '''
Created on Oct 12, 2016
@author: mwitt_000
'''
import network_2_2
import link_2
import threading
from time import sleep
##configuration parameters
router_queue_size = 0 # 0 means unlimited
simulation_time = 1 # give the network sufficient time to transfer all packets before quitting
if __name__ =... |
plugin_scheduler.py | # code for cores isolation was inspired by Tuna implementation
# perf code was borrowed from kernel/tools/perf/python/twatch.py
# thanks to Arnaldo Carvalho de Melo <acme@redhat.com>
from . import base
from .decorators import *
import tuned.logs
import re
from subprocess import *
import threading
import perf
import se... |
backup-service.py | #!/usr/bin/env python
# Minebox backup service. See README.md in this directory for more info.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from flask import Flask, request, jsonify, json
from os import environ
import os
import time
import logging
import... |
mqtt_wss_example_test.py | from __future__ import unicode_literals
from __future__ import unicode_literals
from builtins import str
import re
import os
import sys
import ssl
import paho.mqtt.client as mqtt
from threading import Thread, Event
from tiny_test_fw import DUT
import ttfw_idf
event_client_connected = Event()
event_stop_client = Event... |
test_unhandled_exception_handler.py | from contextlib import suppress
import sys
from threading import Thread
from unittest.mock import call, mock_open, MagicMock
from app.util import process_utils
from test.framework.base_unit_test_case import BaseUnitTestCase
from test.framework.comparators import AnyStringMatching
from app.util.unhandled_exception_hand... |
api.py | #!/usr/bin/python3 -OO
# Copyright 2007-2021 The SABnzbd-Team <team@sabnzbd.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any late... |
debugger.py | import threading
import time
import getpass
import rpyc
import urwid
# TODO global scope variable are evil
screen = None
class Service(rpyc.Service):
def on_connect(self):
global screen
if not screen:
return
screen.addSysMessage("Watcher connected")
def ... |
s3_restore.py | #!/usr/bin/python3
import sys
import time
import boto3
import queue
import logging
import argparse
import datetime
import threading
import multiprocessing
from os import path
from botocore.exceptions import ClientError
AWS_PROFILE = 'default'
PERCENT_QUEUE = queue.Queue()
def setup_logger(logfile):
logger = log... |
notification_telegram.py | from multiprocessing import Process
import telebot
import pickle
import redis
from base import redis_params
from decouple import config
redis_conn = redis.Redis(**redis_params)
bot = telebot.TeleBot(
config("TELEGRAM_TOKEN"),
parse_mode=None,
)
CHAT_ID = config("CHAT_ID")
cache = {}
def do_notify(data: di... |
bomberman-main-server.py | import pygame
import keyboard
import numpy as np
import time
import itertools
import random
# image processing and skin loading
from PIL import Image
def currentMap():
map = np.ones((15,20))
for tile in tileGen():
if(tile[1]%2==1):
if(tile[0]<10):
if(tile[0]%2==1):
... |
RequestSessionTest.py | import uuid
import requests
import random
from multiprocessing import Process
from time import time
from pprint import pprint
def size_test():
session = requests.session()
length = 4 * 1024 * 1024 # ~4MB
data = {"id": "a" * length}
res = session.post("http://localhost:8080/echo", json=data).json()
... |
6.threading.py | #!/usr/bin/python
#encoding=utf8
import time, threading
# 进程默认就会启动一个线程,我们把该线程称为主线程,主线程又可以启动新的线程
# execute code for new thread
def loop():
print('thread %s is running...' %threading.current_thread().name)
n = 0
while n<5:
n += 1
print('thread %s >>> %s' %(threading.current_thread().name, n))
time.sleep(1)
pr... |
MultiWar.py | from blessings import Terminal
term = Terminal()
import os
import sys
import time
import War
import multiprocessing
os.system("clear")
starttime=time.time()
#Some terminal option configuations
#Todo add some terminal configuring options
avcores = multiprocessing.cpu_count() - 1
number_of_total_games= 33000000 # 33 mil... |
queue_wrapper.py | from threading import Thread
from multiprocessing import Queue as mpQueue
from queue import Queue as thQueue, Full, Empty
class QueueWrapper:
"""The `QueueWrapper` is a class that enables the usage of both multiprocessing queue and threading queue with the
`PublishQueue` class.
It listens to both of its q... |
server.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from concurrent import futures
import contextlib
import datetime
import logging
import math
import multiprocessing
import time
import socket
import sys
import grpc
# import the generated classes
import calcul... |
common.py | # Copyright (C) Mesosphere, Inc. See LICENSE file for details.
"""
Common code for AR instance management.
"""
import abc
import copy
import logging
import os
import queue
import select
import signal
import socket
import subprocess
import threading
import time
import pytest
from util import LOG_LINE_SEARCH_INTERVAL... |
predict_GUI_v1.py | import sys
import os
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from cv2 import *
import threading
import time
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QWidget, QApplication, QGroupBox, QPushButton, QLabel, QHBoxLayout, QVBoxLayout, QGridLayout, QFormLayout, ... |
__init__.py | # Copyright 2017 Mycroft AI 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 writin... |
ipythonwidget.py | import os
import json
from threading import Thread, Event
from IPython.core.display import display, HTML
from traitlets import Unicode, Dict, default
from ipywidgets import DOMWidget, Layout, widget_serialization
class MetricVisualizer(DOMWidget):
_view_name = Unicode('CatboostIpythonWidgetView').tag(sync=True)
... |
executor.py | from __future__ import annotations
import inspect
import logging
import resource
import traceback
from contextlib import ExitStack
from datetime import datetime
from itertools import chain
from threading import Thread, current_thread
from typing import List, Callable, TypeVar, Iterable, Sequence, Dict, Optional
impor... |
selenium_bot.py | #setup selenium
from selenium import webdriver
import os
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager as CM
from selenium.webdriver.support import expected_conditions as EC
import time
from mains import *
from thread... |
passenger_wsgi.py | import site
import threading
import sys, os
pkgdir = os.path.join(os.path.dirname(__file__), 'lib')
site.addsitedir(pkgdir)
os.environ['PYTHONPATH'] = pkgdir + os.pathsep + os.environ.get('PYTHONPATH', '')
from app import app as dashapp
import app as cryptoapp
application = dashapp.server
cryptoapp.handleArgs(sys.a... |
client.py | """
Copyright 2019 InfAI (CC SES)
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... |
Hiwin_RT605_ArmCommand_Socket_20190627192435.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##多執行序
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
test_MMTransE_lan_mapping_120k_fk.py | import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '../../src/MMTransE'))
from MMTransE import MMTransE
import time
import multiprocessing
from multiprocessing import Process, Value, Lock, Manager, Array
import numpy as np
from numpy import linalg as LA
fmap = os.path.join(os.path... |
maint.py | # -*- coding: utf-8 -*-
'''
Define the behaviors used in the maintinance process
'''
# Import python libs
import multiprocessing
import os
# Import ioflo libs
import ioflo.base.deeding
# Import salt libs
import salt.fileserver
import salt.loader
import salt.utils.minions
import salt.daemons.masterapi
class ForkMain... |
S_Pipe.py | '''
管道:类似于socket
'''
from multiprocessing import Process, Pipe
def f(conn):
conn.send([42, None, 'hello from child'])
conn.send([42, None, 'hello from child3'])
print("",conn.recv())
conn.close()
if __name__ == '__main__':
parent_conn, child_conn = Pipe() # 新建的管道返回2个参数,一个收,一个发
p = Process(targe... |
test_dbapi.py | # pysqlite2/test/dbapi.py: tests for DB-API compliance
#
# Copyright (C) 2004-2010 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of t... |
spy.py | import os
import threading
import requests
data_path = './data'
tsv_file_path = './tgif-v1.0.tsv'
def check_list():
return os.listdir(data_path)
def all_url():
res = []
with open(tsv_file_path, 'r') as f:
content = f.readlines()
content = [x.strip() for x in content]
for x in content:
... |
cnn_util_test.py | # Copyright 2018 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... |
start.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 logging
import setproctitle
from abci import TmVersion, ABCI
import planetmint
from planetmint.lib import ... |
run.py | import os
import threading
import subprocess as sp
RESULT_DRECTORY = 'results'
class Runner:
def __init__(self, cmd):
self.cmd = cmd
def run_it(self):
os.system(self.cmd)
def run_vendor(vendor_dir, vendor):
print "Running vendor: " + vendor
p = sp.Popen("find {} -name 'squashfs-roo... |
run_oneshot_batch.py | # -- coding: utf-8 -*-
#pylint: disable=invalid-name
import os
import argparse
import subprocess
import multiprocessing
import yaml
GPUs = [1, 2, 6]
parser = argparse.ArgumentParser()
parser.add_argument("ckpt_dir")
parser.add_argument("--result-dir", required=True)
parser.add_argument("--batch-size", required=Tru... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.