source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
build.py | # Copyright 2014 The Oppia 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 ... |
Tally_excel_sheet.py | import xlsxwriter
import sqlite3
import os
from styling import export_path
import threading
from tkinter import messagebox
def export_window():
try:
threading.Thread(target=convert_to_excel_sheet()).start()
messagebox.showinfo("Export", "Export sucessful")
except:
messagebox.showerror("... |
master.py | #!/usr/bin/python3
import time
import sys
from datetime import datetime
import csv
import threading
from multiprocessing import Process
import configparser
import fileinput
import RPi.GPIO as GPIO
import numpy as np
import os
import board
import busio
import adafruit_ads1x15.ads1015 as ADS
import adafruit_ads1x15.ad... |
main.py | """
main module initializes yolov5,
rs pipeline,
and starts algorithm
"""
from threading import Thread
from time import sleep
import pyrealsense2 as rs
import cv2
import numpy as np
import sys
import torch
from pathlib import Path
import algorithm
from robot import getrobot, set_init_ori
from phoenixutils import valid... |
handler.py | import logging
import queue
import sys
import threading
import traceback
from logging.handlers import BufferingHandler
from queue import Queue
import time
from influxdb import InfluxDBClient
PY3 = sys.version_info[0] == 3
WAN_CHUNK, LAN_CHUNK = 1420, 8154
if PY3:
data, text = bytes, str
else:
data, text = st... |
mainwindow.py | # QT
from PyQt5.QtWidgets import QMainWindow, QLabel, QApplication
from PyQt5.QtGui import QPixmap
# External
from music21 import *
from pygame import mixer
import pygame
import numpy as np
# Internal
from mainwindow_ui import *
from add_track import *
from about import *
from dialog2 import *
from utils import *
T... |
network.py | # Copyright 2019 Uber Technologies, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
app.py | from receiver import receiveCount
from webServer import webserver
from multiprocessing import Process
p2 = Process(target=receiveCount)
p2.start()
p1 = Process(target=webserver)
p1.start()
# and so on
p2.join()
p1.join()
# the join means wait untill it finished |
ps5.py | # 6.0001/6.00 Problem Set 5 - RSS Feed Filter
# Name: Daniel Sprehe
# Date: 4/16/2020
import feedparser
import string
import time
import threading
from ps5_project_util import translate_html
from mtTkinter import *
from datetime import datetime
import pytz
# ----------------------------------------------------------... |
wsdump.py | #!/Users/Amish/Development/Trading/gemini-trading-app2/venv/bin/python
import argparse
import code
import sys
import threading
import time
import ssl
import gzip
import zlib
import six
from six.moves.urllib.parse import urlparse
import websocket
try:
import readline
except ImportError:
pass
def get_encodi... |
client.py | from typing import BinaryIO
from .lib.objects import *
from .lib.exceptions import *
from .threads import Threads
from .eventsource import SSE, Recall
import threading
import random
import requests
import json
class Client(Threads, Recall, SSE):
def __init__(self, session_id: int = str(random.ra... |
runner.py | # -*- coding: utf-8 -*-
__author__ = "苦叶子"
"""
公众号: 开源优测
Email: lymking@foxmail.com
"""
import os
import platform
import codecs
import time
import json
import subprocess
from datetime import datetime
from threading import Thread, Timer
import xml.etree.ElementTree as ET
from flask import current_app
from flask_lo... |
AVR_Miner.py | #!/usr/bin/env python3
##########################################
# Duino-Coin Python AVR Miner (v2.5.7)
# https://github.com/revoxhere/duino-coin
# Distributed under MIT license
# © Duino-Coin Community 2019-2021
##########################################
# Import libraries
import sys
from configparser import ConfigPa... |
ctcn_reader.py | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
#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... |
serializers.py | from datetime import datetime
import tempfile
import logging
import os
import threading
from django.core.files.uploadedfile import SimpleUploadedFile
from wand.image import Image
from rest_framework import serializers
from .models import Directory, Document
logger = logging.getLogger(__name__)
THUMBNAIL_CREATE_TIM... |
sessions.py | import time
import threading
import traceback
from joblib import load
from . import logger
from .dataCollector import DataStack
from .BCIDecoder import BCIDecoder
class TrainSession(object):
''' The train session
1. Automatically collecting data;
2. Stop to training the decoder;
3. St... |
core.py | # <HTTPretty - HTTP client mock for Python>
# Copyright (C) <2011-2020> Gabriel Falcão <gabriel@nacaolivre.org>
#
# 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, includ... |
api.py | # Copyright (c) 2021-2022, NVIDIA CORPORATION. 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 ... |
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, content):
app = current_app._get_current_object()
msg = Message(app.con... |
__init__.py | # Copyright 2019 Atalaya Tech, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing,... |
tasks.py | # import os
# import sys
# sys.path.insert(0, os.getcwd())
from manage import app as application
app_context = application.app_context()
app_context.push()
from app import db
from app import mail
from app.models import Task
import time
from datetime import datetime
from threading import Thread
from flask import ... |
proxier.py | import atexit
from concurrent import futures
from dataclasses import dataclass
import grpc
import logging
from itertools import chain
import json
import socket
import sys
from threading import Lock, Thread, RLock
import time
import traceback
from typing import Any, Callable, Dict, List, Optional, Tuple
import ray
from... |
lala.py | #!/usr/bin/python
from multiprocessing import Process, Queue
import time, random
def do_something(n_order, x, queue):
time.sleep(5)
queue.put((n_order, x))
def main():
data = [1,2,3,4,5]
queue = Queue()
processes = [Process(target=do_something, args=(n,x,queue)) for n,x in enumerate(data)]
... |
PythonMemSer.py | import mmap
import contextlib
import time
import json
import win32api
import win32con
import serial
import threading
import xmltodict
import socket
import sys
import os
class pySerial:
hander = serial.Serial()
IsSerialOpen = False
def begin(self,portx,bps):
print("open:")
... |
sndplay.py | import time
import threading
import numpy as np
__all__ = ['play']
# FIXME this really should be a class Player
def _play(snd, starttime, endtime, frames_per_buffer=1024*10):
import pyaudio # here so that we only import dependency when really used
startindex = int(np.round(snd.fs*starttime))
endindex =... |
x-rates.py | # -*- coding: utf-8 -*-
'''
x-rates
'''
__author__ = 'Libao Jin'
__date__ = 'Aug 31, 2015'
import urllib.parse
import urllib.request
import re
import csv
import time
import os
import threading
import numpy as np
def format_date(date):
year, month, day = date
date = str(year).zfill(2) + '-' + str(month).zfil... |
PlatformManagerWindows.py | """ Platform-specific code for Windows is encapsulated in this module. """
import os
import re
import time
import numpy
import ctypes
import threading
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
from ctypes import wintypes
from PIL import Image, ImageTk, ImageOps
from .SettingsDebug imp... |
graphs.py | import os
import sys
import time
import json
from typing import Callable, Any, Tuple, List, Mapping
# PACKAGE
from private.graphs import graphers
from private.logs import logDecorator
from private.helpers import pandasHelper, pathsHelper, keysHelper, kwargsHelper, filesHelper
MODULE_NAME = "graphs"
genericLog = log... |
swarming_load_test_bot.py | #!/usr/bin/env python
# Copyright 2013 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Triggers a ton of fake jobs to test its handling under high load.
Generates an histogram with the latencies to process t... |
transformice.py | import time
from utils import logging
from server.tcp.TCPSocket import *
from server.json.JSONServer import *
from server.managers.TCPClientManager import *
from server.managers.JSONManager import *
__author__ = "b3ckerdev"
__license__ = "MIT License"
class Transformice:
__sockets__ = {}
@staticmethod... |
copyutil.py | # cython: profile=True
# 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
# "... |
serial2tcp.py | #(C)2002-2003 Chris Liechti <cliechti@gmx.net>
#redirect data from a TCP/IP connection to a serial port and vice versa
#requires Python 2.2 'cause socket.sendall is used
import sys
import os
import serial
import threading
import socket
import logging
import signal
from argparse import ArgumentParser
from serial.tools... |
history_tracer.py | #@+leo-ver=5-thin
#@+node:vitalije.20190928154420.1: * @file ../plugins/history_tracer.py
#@+<< docstring >>
#@+node:vitalije.20190928154420.2: ** << docstring >>
"""This plugin cooperates with leo-ver-serv utilty.
To install leo-ver-serv visit https://crates.io/crates/leo-ver-serv
In idle time, whenever user h... |
csv_4VA.py | import numpy as np
from picamera import PiCamera
from tinkerforge.ip_connection import IPConnection
from tinkerforge.brick_imu_v2 import BrickIMUV2 as IMU
from math import pi
import csv, sys, threading, cv2, time
def imu_acq(freq, imu, d):
#csv header configuration
Entete_csv = [
'timestamp',
... |
gpsegwalrep.py | #! /usr/bin/env python
"""
Initialize, start, stop, or destroy WAL replication mirror segments.
============================= DISCLAIMER =============================
This is a developer tool to assist with development of WAL replication
for mirror segments. This tool is not meant to be used in production.
It is sug... |
salesforce.py | from calendar import timegm
from datetime import datetime
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
import http.client
import jwt
import os
import re
import requests
from urllib.parse import quote
from urllib.parse import parse_qs
from urllib.parse import urljoin
from urllib.pars... |
replay_buffer_writer.py | import time
from queue import Queue, Empty, Full
from threading import Thread
from rollout_storage.intefaces.replay_fill_queue_strategy import ReplayFillQueueStrategy
class ReplayWriterQueue:
def __init__(self, replay_buffers, queue_size: int, fill_in_strategy: ReplayFillQueueStrategy, flags, stop_event):
... |
compute_JI.py | import os
import sys
import math
import argparse
from multiprocessing import Queue, Process
from tqdm import tqdm
import numpy as np
from .JIToolkits.JI_tools import compute_matching, get_ignores
sys.path.insert(0, '../')
import utils.misc_utils as misc_utils
gtfile = '/data/annotation_val.odgt'
nr_procs = 10
def e... |
pydoc.py | #!/usr/bin/env python
# -*- coding: latin-1 -*-
"""Generate Python documentation in HTML or text for interactive use.
In the Python interpreter, do "from pydoc import help" to provide online
help. Calling help(thing) on a Python object documents the object.
Or, at the shell command line outside of Python:
Run "pydo... |
data_generator.py | """
Copyright (c) Facebook, Inc. and its affiliates.
"""
import threading
import time
from abc import ABC, abstractmethod
class DataGenerator(ABC):
"""
This class is an abstraction of a data generator which generates all kinds of data
and stores them at give location (local, cloud, etc.)
It maintain... |
runner.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home() :
return "Hogwarts' Hat"
def run () :
app.run(host='0.0.0.0',port="8080")
def alive() :
t = Thread(target=run)
t.start() |
main.py | from tetris import *
from random import *
import threading
def LED_init():
thread=threading.Thread(target=LMD.main, args=())
thread.setDaemon(True)
thread.start()
return
def rotate(m_array, rot_num):
N = len(m_array)
rot_m = [[0] * N for _ in range(N)]
if rot_num % 4 == 1:
... |
tcp.py | """
TCP transport classes
Wire protocol: "len(payload) msgpack({'head': SOMEHEADER, 'body': SOMEBODY})"
"""
import errno
import logging
import os
import queue
import socket
import threading
import time
import traceback
import urllib.parse as urlparse
import weakref
import salt.crypt
import salt.exceptions
import sal... |
subscriber.py | #!/usr/bin/python3
# cf. https://github.com/joewalnes/websocketd/wiki/Simple-Python-Duplex-Example
#
# example usage:
# websocketd --port=4430 --ssl --sslcert /ssl/fullchain.pem --sslkey /ssl/privkey.pem subscriber.py --devconsole
#
from sys import stdout, stdin
import sys
import threading
import redis
import json
imp... |
appsStock.py | # -*- coding: utf-8 -*-
import pandas_datareader.data as web
import datetime
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
from dash.dependencies import Input, Output
# time handel
import multiprocessing
def find_stock(name):
web.DataReader(name, ... |
count.py | #!/usr/bin/env python
# Copyright 2015 The Swarming Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0 that
# can be found in the LICENSE file.
"""Calculate statistics about tasks.
Saves the data fetched from the server into a json file to enable reprocessing
the... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import electrum
from electrum.bitcoin import TYPE_ADDRESS
from electrum import WalletStorage, Wallet
from electrum_gui.kivy.i18n import _
from electrum.paymentrequest import InvoiceStore
from electr... |
Server.py | #!/usr/bin/python3
import flask
import os
import pickle
import time
from urllib import request
from urllib.error import HTTPError, URLError
import json
import threading
from hashlib import md5 # Super secure
import random
import logging
import shutil
from IO import IO
from logging.handlers import RotatingFileHandle... |
create_txprobe.py | from binascii import hexlify, unhexlify
from bitcoin.core import *
from bitcoin.core.key import *
from bitcoin.core.script import *
from bitcoin.core.scripteval import *
from bitcoin import base58
from bitcoin.messages import *
import time
from cStringIO import StringIO
from test_createtx import Transaction, void_coinb... |
process.py | import cv2 as cv
import numpy as np
from threading import Thread
from frame_queue import FrameQueue
import queue
import time
import os
import sys
from utils import file_path
class ImageProcessor:
'''Process images with the OpenCV DNN YOLO implementation.
Images and predictions are stored in parallel queues.''... |
row_mat_byte_rec.py | #!/usr/bin/python
#
# This file is part of PyRQA.
# Copyright 2015 Tobias Rawald, Mike Sips.
"""
RQA, Fixed Radius, OpenCL, RowMatByteRec
"""
import numpy as np
import os
import pyopencl as cl
import threading
import Queue
from ....abstract_classes import AbstractRunnable
from ....opencl import OpenCL
from ....proc... |
test_uvicorn_int.py | import os
from multiprocessing import Process
from time import sleep
from urllib.parse import urljoin
import pytest
import requests
import uvicorn
from server import app
class ClientSession(requests.Session):
def __init__(self, base_url):
self.base_url = base_url
super().__init__()
def reque... |
manager_server.py | import os
from datetime import datetime, timedelta
from concurrent.futures import ThreadPoolExecutor
import threading
import time
from lib.config import logger, domain_name
from lib.hoar_frost import HoarFrostGenerator
import grpc
import lib.ipc.manager_pb2_grpc as manager_grpc
import lib.ipc.manager_pb2 as message
f... |
driver.py | # Firmware for hall-sensor based filament diameter sensors.
# Reads analog value from the sensor and provides a mapped and filtered diameter
# reading over I2C (optional analog output)
# Runs on Raspberry Pi Pico ($4)
# Licensed CC-0 / Public Domain by John Moser
#
# Threads and power usage:
# - Main loop: block on i... |
test_gpsdclient.py | import socket
import threading
import time
from collections import Counter
from gpsdclient import GPSDClient
from .gpsd_fake import GPSD_OUTPUT, VERSION_HEADER, fake_gpsd_server
socket.setdefaulttimeout(10)
def start_fake_server():
server = threading.Thread(target=fake_gpsd_server)
server.start()
time.... |
app.py |
from flask import Flask, render_template, request, redirect, url_for, flash
##########################
#### importing flask extensions ####
##########################
from flask_login import LoginManager, login_user, current_user, login_required, logout_user
from flask_mail import Mail, Message
from threading import... |
mod.py | #!/usr/bin/env python
from http.server import HTTPServer, BaseHTTPRequestHandler
import json
import os
import queue
import sys
import threading
# For json-encoded lines of text sent to the mod
QUEUE = queue.Queue()
CACHE = {"line": "no game data yet"}
def log(message):
f = open(os.path.expanduser("~/mod.log"), ... |
server.py | """
This file takes part of the server side of the peer to peer network
This file deals with uploading of the song for other peers
"""
from server_client.constants import *
class Server:
def __init__(self,msg):
try:
# the message to upload in bytes
self.msg = msg
... |
tcp_client.py | # Copyright (c) 2017, 2018 Jae-jun Kang
# See the file LICENSE for details.
import asyncore
import errno
import socket
from threading import Thread
from x2py.util.trace import Trace
from x2py.links.client_link import ClientLink
from x2py.links.asyncore.tcp_session import TcpSession
class TcpClient(ClientLink):
"... |
conftest.py | import asyncio
import logging
import os
import pprint
from subprocess import PIPE, run
from threading import Thread
import pytest
from pygls import features
from pygls.server import LanguageServer
from cmake_language_server.server import CMakeLanguageServer
@pytest.fixture()
def cmake_build(shared_datadir):
sou... |
tf_util.py | import joblib
import numpy as np
import tensorflow as tf # pylint: ignore-module
import copy
import os
import functools
import collections
import multiprocessing
def switch(condition, then_expression, else_expression):
"""Switches between two operations depending on a scalar value (int or bool).
Note that bot... |
debug.py |
import code
import gc
import logging
import os
import signal
import socket
import threading
import traceback
import tracemalloc
from types import FrameType
from django.conf import settings
from django.utils.timezone import now as timezone_now
from typing import Optional
logger = logging.getLogger('zulip.debug')
# I... |
fracturePP.py | import os
import subprocess
import sys
import threading
import shutil
import numpy as np
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QMessageBox
from matplotlib.backends.backend_qt5 import NavigationToolbar2QT as NavigationToolbar
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCan... |
stk500v2.py | """
STK500v2 protocol implementation for programming AVR chips.
The STK500v2 protocol is used by the ArduinoMega2560 and a few other Arduino platforms to load firmware.
This is a python 3 conversion of the code created by David Braam for the Cura project.
"""
import struct
import sys
import time
from serial import Ser... |
__main__.py | """
Multi-threaded match-making game server
"""
import os
import random
from datetime import datetime
import threading
from collections import defaultdict
from referee.log import StarLog
from referee.game import play, IllegalActionException, COLOURS, NUM_PLAYERS
from benchmark import RandomPlayer, GreedySpreadPlayer
... |
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... |
conftest.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright (c) 2002-2020 "Neo4j,"
# Neo4j Sweden AB [http://neo4j.com]
#
# This file is part of Neo4j.
#
# 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 L... |
CoverageEvaluator.py | # Evaluate DroidBot with androcov
# basic idea is:
# A tool is better if it has higher coverage
import argparse
import os
import logging
import sys
import threading
import time
import subprocess
from datetime import datetime
from droidbot.droidbot import DroidBot
START_EMULATOR_CMD = "emulator -avd %s -port %d -wipe-... |
create_cb_containers.py | #!/usr/bin/env/python
import os, sys, argparse, json, subprocess, paramiko, requests, time, threading
from scp import SCPClient
spark_worker_container='spark_worker'
spark_master_container='spark_master'
couchbase_container='couchbase_base'
couchbase_ips = []
spark_worker_ips = []
spark_master_ips = []
container_prefi... |
dijkstra.py | # Copyright 2016 Uber Technologies, 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 ... |
script_v2.py | from threading import Thread
from Queue import Queue, Empty
from scapy.all import *
m_iface = "wlan1"
m_finished = False
def print_summary(packet):
target = {'uol.com':'200.147.67.142',
'google.com':'173.194.118.35',
'facebook.com':'173.252.120.6',
'gmail.com':'216.58.222.5'
}
if packet.haslay... |
multiprocess_timeout.py | from multiprocessing import Process
from je_auto_control.utils.exception.exceptions import AutoControlTimeoutException
from je_auto_control.utils.exception.exception_tag import timeout_need_on_main_error
def multiprocess_timeout(check_function, time: int):
try:
new_process = Process(target=check_function)... |
noise_shaping.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2017 Tomoki Hayashi (Nagoya University)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
from __future__ import division
from __future__ import print_function
import argparse
from distutils.util import strtobool
import multiprocessing as mp
import ... |
test_browser.py | # coding=utf-8
# Copyright 2013 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
import argparse
import json
import multiprocessing
imp... |
base.py | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... |
core.py | from __future__ import print_function
import errno
import logging
import os
import pickle
import random
import re
import time
import requests
from bs4 import BeautifulSoup
import json
from fake_useragent import UserAgent
from newspaper import Article
import threading
from datetime import datetime, timedelta
from dateut... |
dense_update_ops_no_tsan_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_server.py | import os
from multiprocessing.managers import DictProxy
import requests
import time
import tempfile
import uuid
from typing import List, Text, Type, Generator, NoReturn
from contextlib import ExitStack
from _pytest import pathlib
from aioresponses import aioresponses
import pytest
from freezegun import freeze_time... |
multithreadAsync.py | import asyncio
from threading import Thread
from multiprocessing import Process
from time import sleep
from LibF.GPA import *
#Mutli Thread Concurrency
#"@MAN.main.task" adds the function below to a tasks list
@MAN.main.task
#MAN is a built in manager for having up to 4 concurrent threads
async def helloWorld():
... |
manager.py | #!/usr/bin/env python2.7
import os
import sys
import fcntl
import errno
import signal
import subprocess
from common.basedir import BASEDIR
sys.path.append(os.path.join(BASEDIR, "pyextra"))
os.environ['BASEDIR'] = BASEDIR
if __name__ == "__main__":
if os.path.isfile("/init.qcom.rc") \
and (not os.path.isfile("... |
main.py | # Name: Nigel Jacob
# Date: 26/07/2021
import config
import cv2 as cv
import RPi.GPIO as GPIO
from threading import Thread
def analyse() -> None:
print("Press 'q' to exit.")
while not cv.waitKey(1) & 0xFF == ord("q"):
try:
(success, img) = config.cap.read()
(class_ids, confs,... |
run.py | """
Martlet 4/Pulsar Ground Control Software
CUSF 2018/19
"""
from gcs import usb
from gcs import gui_interface
from gcs import logging
import time
import signal
import multiprocessing
import argparse
# Todo: freeze script into executable once done
def run(args):
"""Initialise and run the backend.
args -- c... |
bomber.py | #!/usr/bin/env python
from datetime import datetime
import os
import hashlib
import sys
import time
import threading
import string
import random
import base64
import urllib.request
import urllib.parse
try:
import requests
except ImportError:
print('[!] Error: some dependencies are not installed')
print('Ty... |
threaded.py | # vim:fileencoding=utf-8:noet
from __future__ import absolute_import
from powerline.lib.monotonic import monotonic
from threading import Thread, Lock, Event
class MultiRunnedThread(object):
daemon = True
def __init__(self):
self.thread = None
def is_alive(self):
return self.thread and self.thread.is_alive... |
test_download_client.py | import copy
from multiprocessing import Process, cpu_count
import os
import os.path
import pytest
import tarfile
import tempfile
import time
from unittest import TestCase
from gdc_client.parcel.const import HTTP_CHUNK_SIZE, SAVE_INTERVAL
from gdc_client.parcel.download_stream import DownloadStream
import mock_server
... |
async_optimization.py | import time
import random
from bayes_opt import BayesianOptimization
from bayes_opt.util import UtilityFunction, Colours
import asyncio
import threading
try:
import json
import tornado.ioloop
import tornado.httpserver
from tornado.web import RequestHandler
import requests
except ImportError:
... |
imap.py | """
Display number of unread messages from IMAP account.
Configuration parameters:
allow_urgent: display urgency on unread messages (default False)
auth_scope: scope to use with OAuth2 (default 'https://mail.google.com/')
auth_token: path to where the pickled access/refresh token will be saved
afte... |
decorator.py | """Decorators"""
import sys
import time
import traceback
from functools import wraps
from threading import Thread
__all__ = list(globals())
def main(f):
if len(sys.argv) == 1:
f()
for v in sys.argv[1:]:
f(v)
return f
def timeit(f):
@wraps(f)
def wrapper(*args, **kwargs):
... |
cts_utils.py | # Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Stage the Chromium checkout to update CTS test version."""
import contextlib
import json
import operator
import os
import re
import six
import sys
import ... |
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... |
TFCluster.py | # Copyright 2017 Yahoo Inc.
# Licensed under the terms of the Apache 2.0 license.
# Please see LICENSE file in the project root for terms.
"""
This module provides a high-level API to manage the TensorFlowOnSpark cluster.
There are three main phases of operation:
1. **Reservation/Startup** - reserves a port for the T... |
Assignment5.py | import queue
import time
import threading
from urllib.request import urlopen, Request
from concurrent.futures import ThreadPoolExecutor
from queue import Queue
# https://www.geeksforgeeks.org/how-to-use-threadpoolexecutor-in-python3/
# Threading allows parallelism of code and Python language has two ways to achieve it... |
touch.py | #!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import time
import cv2
from robot import Robot
import threading
import os
import utils
class HumanControlOfRobot(object):
"""Creates a color and depth opencv window from the robot camera, gets human keyboard/click, and moves the robot.
... |
cli.py | # -*- coding: utf-8 -*-
"""
flask.cli
~~~~~~~~~
A simple command line application to run flask apps.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
from threading import Lock, Thread
from functools import update_wrapper
... |
wurlitzer.py | """Capture C-level FD output on pipes
Use `wurlitzer.pipes` or `wurlitzer.sys_pipes` as context managers.
"""
from __future__ import print_function
__version__ = '0.2.1.dev'
__all__ = [
'Wurlitzer',
]
from contextlib import contextmanager
import ctypes
from fcntl import fcntl, F_GETFL, F_SETFL
import io
import ... |
run_gui.py | """
IMPORTANT usage note:
place slurm_settings.areg at the same folder where script is located
modify cluster_configuration.json according to cluster configuration
and builds available
"""
import argparse
import errno
import getpass
import json
import os
import re
import shutil
import signal
import socket
import subpro... |
index.py | #!/usr/bin/python3
import cgi
import mysql.connector
from datetime import datetime, timedelta
from threading import Thread
import json
import yfinance as yf
def commit(ticker_symbol, results, cursor, cnx):
sql1 = "DELETE FROM yahoofinancessustainable WHERE ticker='{}';".format(ticker_symbol)
sql2 = "INSERT INT... |
table.py | import time
import uuid
from threading import Thread, Lock
from deuces.deuces import Card, Deck, Evaluator
from .player import Player
class Table(object):
BLIND_INCREMENTS = [[10,25],[25,50],[50,100],[75,150],[100,200],[150,300],[200,400],[300,600],[400,800],[500,10000],[600,1200],[800,1600],[1000,2000]]
def... |
50_po_history.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import csv
from xmlrpc import client as xmlrpclib
import multiprocessing as mp
from scriptconfig import URL, DB, UID, PSW, WORKERS
# ==================================== Purchase ORDER ====================================
def update_purchase_order(pid, data_pool, error... |
multistart.py | """
///////////////////////////////////////////////////////////////////////////////
// Authors: Chester Holtz, Devon Merrill, James (Ting-Chou) Lin, Connie (Yen-Yi) Wu
// (respective Ph.D. advisors: Chung-Kuan Cheng, Andrew B. Kahng, Steven Swanson).
//
// BSD 3-Clause License
//
// Copyright (c) 2018, The Reg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.