source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
threading_simple.py | import threading
def worker(num):
# * thread worker function
print(f"worker: {num}")
return
if __name__ == "__main__":
threads = []
for i in range(5):
t = threading.Thread(target=worker, args=(i,))
threads.append(t)
t.start()
#! apparently the multithreading sequence sta... |
controller_masstree.py | #!/usr/bin/env python3
from datetime import datetime
from pathlib import Path
import subprocess
import shlex
import gym
import os
from silence_tensorflow import silence_tensorflow
silence_tensorflow()
from stable_baselines import DQN
import threading
import time
import configparser
import loggers
import tensorflow as t... |
injector_test.py | # encoding: utf-8
#
# Copyright (C) 2010 Alec Thomas <alec@swapoff.org>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# Author: Alec Thomas <alec@swapoff.org>
"""Functional tests for the "Injector" dependency inje... |
pwork.py | from multiprocessing import Process, Queue
import time
try:
from Queue import Empty
except ImportError:
from queue import Empty
import logging
from grab.util.py3k_support import *
class Stop(object):
pass
STOP = Stop()
class Worker(Process):
def __init__(self, callback, taskq, resultq, ignore_except... |
__init__.py | '''
Set up the Salt integration test suite
'''
# Import Python libs
import multiprocessing
import os
import shutil
import signal
# Import Salt libs
import salt
import salt.config
import salt.master
import salt.minion
from salt.utils.verify import verify_env
from saltunittest import TestCase
INTEGRATION_TEST_DIR = os... |
test_client.py | from __future__ import annotations
import asyncio
import functools
import gc
import inspect
import logging
import os
import pickle
import random
import subprocess
import sys
import threading
import traceback
import types
import warnings
import weakref
import zipfile
from collections import deque
from collections.abc i... |
test_eap_proto.py | # EAP protocol tests
# Copyright (c) 2014, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import hmac
import logging
logger = logging.getLogger()
import select
import struct
import threading
import time
import hostapd
from utils import H... |
retrieve_threaded.py | #!/usr/bin/env python3
import requests
import time
import threading
from Queue import Queue
urls = [one_line.strip()
for one_line in open('urls.txt')]
length = {}
queue = Queue()
start_time = time.time()
threads = [ ]
def get_length(one_url):
response = requests.get(one_url)
queue.put((one_url, len(... |
r_numpy_lib.py | #This script contains a library of functions that use various open source statistical and geospatial
#software packages to ease basic raster processing and modeling procedures
#This script was written with funding from a USDA Forest Service Remote Sensing
#Steering Commmittee project that used thermal data to model per... |
server.py | '''
This class will represent the reporter-server.
'''
# pylint: disable=C0413, C0411
import os
import sys
import datetime
import json
import pytz
from threading import Thread
from kafka import KafkaProducer
sys.path.append('..')
from libs.gitlabl.files import read_file_from_gitlab
from libs.kafka.topichandler im... |
fgoGui.py | import json,os,sys
from configparser import ConfigParser
from threading import Thread
from PyQt6.QtCore import Qt,pyqtSignal
from PyQt6.QtGui import QAction
from PyQt6.QtWidgets import QApplication,QInputDialog,QMainWindow,QMessageBox,QStyle,QSystemTrayIcon,QMenu
import fgoFunc
from fgoServerChann import ServerChann
f... |
vegascope.py | #!/usr/bin/env python
# Copyright (c) 2018, DIANA-HEP
# 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 ... |
multiprocess_data_loader.py | from collections import deque
import logging
from multiprocessing.process import BaseProcess
from multiprocessing.connection import Connection
import random
import traceback
import select
from queue import Full
from typing import List, Iterator, Optional, Iterable, Union, TypeVar, Tuple, Any
import torch
import torch... |
sequences.py | import logging
import threading
import queue
from .clip import ClipConfig
import xarray as xr
import numpy as np
import tensorflow as tf
from typing import Sequence, Tuple, List, Any, Optional
from .halos import append_halos
import fv3gfs.util
import vcm.safe
from fv3fit._shared.packer import ArrayPacker
from fv3fit.... |
exchange_rate.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from datetime import datetime
import inspect
import requests
import sys
from threading import Thread, Lock
import time
import traceback
import csv
from decimal import Dec... |
utilities.py | import logging
import sys
import termios
import threading
import time
import tty
from enum import Enum, auto
from pyalpm import vercmp
from subprocess import run
from typing import Tuple, Sequence
import regex
from aurman.aur_utilities import get_aur_info
from aurman.coloring import Colors, aurman_error, aurman_quest... |
main.py | import pdb
import time
import os
import subprocess
import re
import random
import json
import numpy as np
import glob
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
import socket
import argparse
import threading
import _thread
import signal
from datetime import datetime
parser = ar... |
feeder.py | from sklearn.model_selection import train_test_split
from synthesizer.utils.text import text_to_sequence
from synthesizer.infolog import log
import tensorflow as tf
import numpy as np
import threading
import time
import os
_batches_per_group = 64
tf.compat.v1.disable_eager_execution()
class Feeder:
"""
Feeds batch... |
test_mayhem_7.py | #!/usr/bin/env python3
# Copyright (c) 2019 Lynn Root
"""
Testing the event loop - parametrize signals
Notice! This requires:
- pytest==4.3.1
- pytest-asyncio==0.10.0
- pytest-mock==1.10.3
To run:
$ pytest part-5/test_mayhem_6.py
Follow along: https://roguelynn.com/words/asyncio-testing/
"""
import asyncio
imp... |
serv.py | #
# SPDX-License-Identifier: GPL-2.0-only
#
import os,sys,logging
import signal, time
from xmlrpc.server import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
import threading
import queue
import socket
import io
import sqlite3
import bb.server.xmlrpcclient
import prserv
import prserv.db
import errno
import select
lo... |
prediction_map.py | import torch
import multiprocessing as mp
from tqdm import tqdm
# deepbio packages
from deepbiosphere.scripts.GEOCLEF_Config import paths
from multiprocessing import Process
import deepbiosphere.scripts.NAIP_Utils as naip
import deepbiosphere.scripts.GEOCLEF_Utils as utils
if __name__ == '__main__':
mp.set_start_... |
__init__.py | # TODO: add sufficient documentation to the functions and classes in this module
# TODO: Code for Upload to Mega
# TODO: Code for user filters
# TODO: Add and Handle Exceptions
# TODO: Code for direct link generation
import aria2p
import asyncio
import copy
import googleapiclient.discovery
import googleapiclient.errors... |
snab.py | from __future__ import division
import logging
try:
from Queue import Empty
except:
from queue import Empty
from time import time, sleep
from threading import Thread
from collections import defaultdict, Counter
from multiprocessing import Process, Queue
import os
from os import kill, getpid
import traceback
imp... |
loader.py | # Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
test_pdb.py | # A test suite for pdb; not very comprehensive at the moment.
import doctest
import os
import pdb
import sys
import types
import codecs
import unittest
import subprocess
import textwrap
from contextlib import ExitStack
from io import StringIO
from test.support import os_helper
# This little helper class is essential ... |
test_payment_session.py | from time import sleep
from threading import Thread
from concurrent.futures import Future
import unittest
from payment_terminal.exceptions import (
SessionCancelledError, CancelFailedError,
)
from payment_terminal.drivers.bbs.payment_session import BBSPaymentSession
def fulfilled_future(result=None):
""" Sho... |
fuzzer.py | # Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... |
callbacks_test.py | # Copyright 2016 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... |
stdout_writer_semaphore.py | import random
import sys
import threading
import time
lock = threading.Semaphore(2)
def write():
lock.acquire()
sys.stdout.write( "%s writing.." % threading.current_thread().name)
time.sleep(random.random())
sys.stdout.write( "..done\n")
lock.release()
while True:
thread = threading.... |
recipe-577959.py | import threading
from Queue import Queue
# Set up a queue for tasks to be run on the main thread.
# Most UI toolkits as glib contains functions to push task this way.
Q = Queue()
def idle_add(a,b):
Q.put((a,b))
def async_int(gen):
try: gen.next()
except StopIteration: return
def do():
try: gen.ne... |
samplepacketprocessorpy.py | import grpc
import EventNotificationProto_pb2
import ServicesProto_pb2_grpc
import threading
# A Simple packet processor.
def packetprocessor():
channel = grpc.insecure_channel('localhost:50051')
eventNotificationStub = ServicesProto_pb2_grpc.EventNotificationStub(channel)
request = EventNotificationP... |
__init__.py | #
# Unit tests for the multiprocessing package
#
import unittest
import queue as pyqueue
import contextlib
import time
import io
import itertools
import sys
import os
import gc
import errno
import signal
import array
import socket
import random
import logging
import struct
import operator
import weakref
import test.su... |
ipython.py | r"""
The ParaViewWeb iPython module is used as a helper to create custom
iPython notebook profile.
The following sample show how the helper class can be used inside
an iPython profile.
# Global python import
import exceptions, logging, random, sys, threading, time, os
# Update python path to have ParaView libs
pv_pa... |
smbrelayx.py | #!/usr/bin/env python
# Impacket - Collection of Python classes for working with network protocols.
#
# SECUREAUTH LABS. Copyright (C) 2020 SecureAuth Corporation. All rights reserved.
#
# This software is provided under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# f... |
main.py | from tkinter import *
from tkinter import filedialog as fd
from tkinter import messagebox
import tkinter.ttk as ttk
from ttkthemes import ThemedTk
from ttkthemes import ThemedStyle
import youtube_dl
from mutagen.mp3 import MP3
from mutagen.flac import FLAC
from pydub import AudioSegment
import time
import pafy
from PyQ... |
m3portscanner.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-s
import socket
import sys
import os
import time
from threading import Thread
threads = []
timeout = 0.5
os.system("clear")
print('''
\033[1;32m ███ ███\033[39m
\033[1;32m ████ ████\033[39m
\033[1;32m ██ ████ ██ ██████\033[39m ... |
email.py | from flask_mail import Message
from flask import render_template
from app import app, mail
from threading import Thread
from app.models import User
def send_email(subject, sender, recipients, text_body, html_body):
msg = Message(subject, sender=sender, recipients=recipients)
msg.body = text_body
msg.html =... |
vk.py | from bs4 import BeautifulSoup as Bs
from pathlib import Path
import requests as Req
import json as Json
import os as Os
import threading as Th
import time as Time
CTX = 'https://vk.com'
MAX_ACT_THREADS = 20
class DownloadThread (Th.Thread):
def __init__(self, p, dest):
Th.Thread.__init__(self)
se... |
stress_test.py | # USAGE
# python stress_test.py
# import the necessary packages
from threading import Thread
import requests
import time
import cv2
import base64
# initialize the Keras REST API endpoint URL along with the input
# image path
KERAS_REST_API_URL = "https://127.0.0.1/dododo/"
IMAGE_PATH = "jemma.png"
# initialize the nu... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import qtum_electrum
from qtum_electrum.bitcoin import TYPE_ADDRESS
from qtum_electrum import WalletStorage, Wallet
from qtum_electrum_gui.kivy.i18n import _
from qtum_electrum.paymentrequest import... |
__init__.py | import time
import threading
from queue import Queue
from flask import Flask, request
from demo.tracker import RealtimeTrackerDemo
from mot import Observation
app = Flask(__name__)
app.use_reloader=False
task_queue = Queue()
@app.route("/")
def home():
return "This is the root directory of the Flask application... |
teleop_client.py | # Adapted from https://github.com/sergionr2/RacingRobot
# Author: Antonin Raffin
import argparse
import os
import time
import cv2
from threading import Event, Thread
import numpy as np
import pygame
from pygame.locals import *
from stable_baselines.bench import Monitor
from stable_baselines.common.vec_env import VecFr... |
webcam_demo.py | from collections import deque
from operator import itemgetter
from threading import Thread
import cv2
import numpy as np
import torch
from tsn.model.build import build_model
from tsn.data.transforms.build import build_transform
from tsn.util.parser import parse_test_args, load_test_config
from tsn.util.distributed im... |
gst_cam.py | import cv2
import threading
import numpy as np
import imutils
# gstreamer_pipeline returns a GStreamer pipeline for capturing from the CSI camera
# Flip the image by setting the flip_method (most common values: 0 and 2)
# display_width and display_height determine the size of each camera pane in the window on the scree... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
core.py | """
Core logic (uri, daemon, proxy stuff).
Pyro - Python Remote Objects. Copyright by Irmen de Jong (irmen@razorvine.net).
"""
from __future__ import with_statement
import re, sys, time, os
import logging, uuid
from Pyro4 import constants, threadutil, util, socketutil, errors
from Pyro4.socketserver.threadpoolserver... |
start.py | import time
import random
# import for led output
import RPi.GPIO as GPIO
from src.core import setup, Recognize
from src.entry import FingerEntry
from src.constant import COMM_MOTION_DETECTED, COMM_FACE_DETECTED, COMM_FINGER_DETECTED, COMM_INTRUDER_DETECTED
from multiprocessing import Pipe, Process
sender, receiver... |
client.py | ''' Datasource for Mapnik that consumes vector tiles in GeoJSON or MVT format.
VecTiles provides Mapnik with a Datasource that can read remote tiles of vector
data in spherical mercator projection, providing for rendering of data without
the use of a local PostGIS database.
Sample usage in Mapnik configuration XML:
... |
run-logged-aws-playlist.py | #!/usr/bin/env python
import sys
import threading
import time
import os.path
import json
from random import randint
from command_args import get_args
from Deployer import Deployer
from Runner import Runner
from BrokerActions import BrokerActions
from UniqueConfiguration import UniqueConfiguration
from CommonConfigurat... |
find_bad_images_in_skps.py | #!/usr/bin/env python
# Copyright 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This script will take as an argument either a list of skp files or a
set of directories that contains skp files. It will then test each
skp... |
advanced demo.py | #!/usr/bin/env python
# coding: utf-8
# NOTE: this script requires tqdm
# In[1]:
from importlib import reload
from pikax import *
import multiprocessing as mp
from tqdm import tqdm
import os
import itertools
import requests
# disable all logs
settings.LOG_STD = False
settings.LOG_INFORM = False
settings.LOG_WARN... |
normbackanimation.py | """LEGACY GUI application. This was used to make illustrations for the Matura Project.
Basic and advanced Backtracking is Implemented."""
import pygame
import sys
from multiprocessing.pool import ThreadPool
import threading
import copy
from BASolver import solve
from config import Config as c, Temp as t, Solvertype... |
main.py | from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.multiprocessing as mp
from train import train
# Training settings
parser = argparse.ArgumentParser(description='PyTorch MNIST Example')
parser.add_argument('--batch-size', type=int, de... |
detection.py | import ipaddress
import json as classic_json
import multiprocessing as mp
import re
import time
from datetime import datetime
from typing import Callable
from typing import Dict
from typing import List
from typing import NoReturn
from typing import Tuple
import redis
import ujson as json
from artemis_utils import exce... |
threading.py | import Queue
import threading
import urllib2
# called by each thread
def get_url(q, url):
q.put(urllib2.urlopen(url).read())
theurls = ["http://google.com", "http://yahoo.com"]
q = Queue.Queue()
for u in theurls:
t = threading.Thread(target=get_url, args = (q,u))
t.daemon = True
t.start()
s = q.get... |
collector.py | #!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "... |
sac_rad.py | """
Adaptation of Yufeng Yuan's async SAC RAD implementation by Yan Wang & Gautham Vasan:
- https://github.com/YufengYuan/ur5_async_rl/blob/main/sac_rad.py
- https://github.com/Yan-Wang88/visual-reacher-sac/blob/master/algo/sac_rad_agent.py
"""
import queue
import torch
import copy
import rl_algorithms.agent.utils as... |
multilane_api.py | # -*- coding: utf-8 -*-
from base.log import *
import os
from multiprocessing import Process
import redis_pool
def gen_id():
r = redis_pool.get('dornaemon')
return r.incr('deploy_id')
def doversion(deploy_id):
log_path = 'html/deploy_logs/%d.txt' % deploy_id
print '%s' % (log_path)
cmd = "bash /home/op/autohd... |
TransferManager.py | from werkzeug.serving import make_server
from flask import Flask, render_template, request, current_app
from Utilities import LogThread
import threading
import time
import socket
import sqlite3
import os
import plistlib
import console
import shutil
import ui
from zipfile import ZipFile
from Managers import DBManager, ... |
Targets.py | # coding: utf-8
# Author: @aas_s3curity
# Imports
import logging
from core.Colors import debugBlue, warningRed, warningGre, infoYellow, green, white, red
from core.Timeout import timeout
from subprocess import Popen, PIPE
from multiprocessing import Process, Manager
from submodules.pywerview.helpers import invoke_chec... |
Pump.py |
import logging, time, threading, re
from peewee import *
from threading import Lock
from ..db import db, BarbotModel, ModelError, addModel
from ..config import config
from ..bus import bus
from .. import utils
from .. import serial
from .Ingredient import Ingredient
_pumpStopEventPattern = re.compile(r"(?i)PS(\d+)"... |
pvPrediction.py | """
Created on Aug 03 14:02 2018
@author: nishit
"""
import datetime
import json
import os
import threading
import time
from queue import Queue
from IO.influxDBmanager import InfluxDBManager
from IO.radiation import Radiation
from IO.redisDB import RedisDB
from optimization.pvForecastPublisher import PVForecastPubli... |
utilities.py | # coding=utf-8
import threading
import requests
import sys
import time
import os
import json
import glob
from pathlib import Path
def beep(times=1):
for i in range(1, times):
sys.stdout.write(f'\r\a{i}')
sys.stdout.flush()
time.sleep(0.5)
sys.stdout.write('\n')
time.sleep(0.1)
... |
dpsctl.py | #!/usr/bin/env python
"""
The MIT License (MIT)
Copyright (c) 2017 Johan Kanflo (github.com/kanflo)
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 limitat... |
faiss.py | import os
import math
import faiss
import torch
import numpy as np
import threading
import queue
from colbert.utils.utils import print_message, grouper
from colbert.indexing.loaders import get_parts
from colbert.indexing.index_manager import load_index_part
from colbert.indexing.faiss_index import FaissIndex
def ge... |
base.py | # ===============================================================================
# Copyright 2016 Jake Ross
#
# 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... |
4.进程和线程.py | # from multiprocessing import Process
# import os
#
# # 子进程要执行的代码
# def run_proc(name):
# print('Run child process %s (%s)...' % (name, os.getpid()))
#
# if __name__=='__main__':
# print('Parent process %s.' % os.getpid())
# p = Process(target=run_proc, args=('test',))
# print('Child process will start.... |
engine.py | import logging
from logging import Logger
import smtplib
import os
from abc import ABC
from datetime import datetime
from email.message import EmailMessage
from queue import Empty, Queue
from threading import Thread
from typing import Any, Sequence, Type, Dict, List, Optional
from constant import EventType
from trade.e... |
sql_isolation_testcase.py | """
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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.... |
test.py | import threading
import time
def a():
print("Function a is running at time: " + str(int(time.time())) + " seconds.")
def b():
print("Function b is running at time: " + str(int(time.time())) + " seconds.")
####
for i in range(5):
def c():
print(f"Iteration {i}")
print("Function c is ... |
im2rec.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache Licens... |
BlueBot.py | # -*- coding: utf-8 -*-
import subprocess
import os
from colorama import Fore, init
import ctypes
import time
import threading
init(autoreset=True)
green = Fore.LIGHTGREEN_EX
white = Fore.RESET
red = Fore.LIGHTRED_EX
yellow = Fore.YELLOW
blue = Fore.LIGHTCYAN_EX
dblue = Fore.CYAN
gray = Fore.LIGHTBLACK_... |
__init__.py | """Support for the Fibaro devices."""
from __future__ import annotations
from collections import defaultdict
import logging
from fiblary3.client.v4.client import Client as FibaroClient, StateHandler
import voluptuous as vol
from homeassistant.const import (
ATTR_ARMED,
ATTR_BATTERY_LEVEL,
CONF_DEVICE_CLA... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
imperative.py | import sys
import time
from util.logger import setup_logging
from multiprocessing import Process
from multiprocessing import active_children
import flask
app = flask.Flask(__name__)
logger = setup_logging()
STATE = 2
def get_state():
return len(active_children())
@app.route("/spawn", methods=["GET"])
def pro... |
chrono_kart_scrollphat.py | #!/usr/bin/env python
'''
Copyright 2017 Daniele Sabetta
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 requir... |
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.
from __future__ import print_function
import argparse
... |
Thread-Multiprocess.py | # coding=utf-8
"""
使用multiprocessing模块创建多进程
"""
import os
from multiprocessing import Process
# 子进程要执行的代码
def run_proc(name):
print('Child progress %s (%s) Running...'%(name,os.getpid()))
if __name__ == '__main__':
print('Parent process %s.'% os.getpid())
for i in range(5):
p = Process(target=run_... |
evaluate_ensemble.py | import sys
import os
import argparse
from multiprocessing import Process
#pool = multiprocessing.Pool(20)
parser = argparse.ArgumentParser()
parser.add_argument('--model-dir', default='released_model/cnndm_model/ensemble_result/ensemble')
parser.add_argument('--gold-valid', default='data/cnndm/valid.summary')
parser... |
GUI 5.py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'test3.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
import time
import sys
f... |
multitest.py | from multiprocessing import Process
from showdown import main
import time
def run():
p1 = Process(target=main)
p1.start()
|
main.py | from flask import Flask, request, render_template, jsonify
from flask_socketio import SocketIO, emit
from werkzeug import secure_filename
import time
import os
import numpy as np
from PIL import Image
from skimage.color import rgb2gray
from skimage.io import imread, imsave
import matplotlib.pyplot as plt
from... |
threading_12_state.py | # -*- coding: utf-8 -*-
from socket import socket, AF_INET, SOCK_STREAM
import threading
from functools import partial
class LazyConnection:
def __init__(self, address, family=AF_INET, sock_type=SOCK_STREAM):
self.address = address
self.family = family
self.type = sock_type
self.lo... |
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, **kw):
app = current_app._get_current_object()
msg = Message(... |
utils.py | import os
import socket
import time
import threading
from contextlib import contextmanager
from tests.compat import str2bytes
@contextmanager
def server(addr=('127.0.0.1', 3030), params=(), status=200, callback=None):
if isinstance(addr, str) and addr.startswith('/tmp/'):
if os.path.exists(addr):
... |
test_sweeper.py | # -*- coding: utf-8 -*-
import threading
import time
from delayed.queue import Queue, _NOTI_KEY_SUFFIX
from delayed.sweeper import Sweeper
from delayed.task import Task
from .common import CONN, func, QUEUE_NAME, NOTI_KEY
class TestSweeper(object):
def test_run(self):
CONN.delete(QUEUE_NAME)
q... |
multithreadtest.py | '''
Created on Sep 17, 2010
@author: barthelemy
'''
from __future__ import unicode_literals, absolute_import
from multiprocessing import Process
import subprocess
from threading import Thread
import time
import unittest
from py4j.compat import range
from py4j.java_gateway import JavaGateway
from py4j.tests.java_gate... |
3gpp.py | # -*- coding: utf-8 -*-
import threading
import tensorflow as tf
import numpy as np
import signal
import os
import time
from training_thread_3gpp import TrainingThread3GPP
from constants import MAX_TIME_STEP_TEST
from constants import CHECKPOINT_DIR
from constants import LOG_FILE_3GPP
from constants import PLOT_3GPP_... |
animation_threading.py | import threading, time
from .. util import log
class AnimationThreading:
"""
AnimationThreading handles threading - and eventually multiprocessing - for
Animation.
"""
def __init__(self, runner, run):
self.runner = runner
self.run = run
self.stop_event = threading.Event()
... |
dispatcher.py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2021
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... |
recipe-465531.py | import socket; socket.setdefaulttimeout(60)
import Queue # 2.5 module required
import random, time, sys, threading, posixpath, traceback, os
import ftplib
DEFNUMWORKERS = 20 # max active connections
DEFMAXSIZE = 32*1024*1024 # for splitting file
DEFBLOCKSIZE = 32*1024 # for downloading
class JobQueue(... |
RegNet3D.py | import argparse
import copy
import datetime
import logging
import matplotlib as mpl
import multiprocessing
import numpy as np
import os
from pathlib import Path
import shutil
import tensorflow as tf
import time
import functions.reading as reading
import functions.general_utils as gut
import functions.setting.setting_ut... |
protocol_arduinosimulator.py | """Provides a simple simulator for telemetry_board.ino or camera_board.ino.
We use the pragma "no cover" in several places that happen to never be
reached or that would only be reached if the code was called directly,
i.e. not in the way it is intended to be used.
"""
import copy
import datetime
import queue
import r... |
apis_manager.py | import logging
import os
import signal
import threading
import requests
from typing import Optional
from requests.sessions import InvalidSchema
from .azure_graph import AzureGraph
from .config_reader import ConfigReader
from .data.logzio_connection import LogzioConnection
from .data.auth_api_data import AuthApiData
fr... |
run.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
fMRI preprocessing workflow
=====
"""
import os
import re
from pathlib import Path
import logging
import sys
import gc
import uuid
import warnings
from argparse import ArgumentParser
from argparse import ArgumentDefaultsHelpFormatter
from multiprocessing import cpu_co... |
nanny.py | import asyncio
from contextlib import suppress
import errno
import logging
from multiprocessing.queues import Empty
import os
import psutil
import shutil
import threading
import uuid
import warnings
import weakref
import dask
from dask.system import CPU_COUNT
from tornado.ioloop import IOLoop, PeriodicCallback
from to... |
main_gan_user_model.py | import datetime
import numpy as np
import os
import tensorflow as tf
import threading
from ganrl.common.cmd_args import cmd_args
from ganrl.experiment_user_model.data_utils import Dataset
from ganrl.experiment_user_model.utils import UserModelLSTM, UserModelPW
def multithread_compute_vali():
global vali_sum, val... |
service.py | # Copyright 2017 Red Hat, 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, ... |
_darwinmouse.py | import os
import datetime
import threading
import Quartz
from ._mouse_event import ButtonEvent, WheelEvent, MoveEvent, LEFT, RIGHT, MIDDLE, X, X2, UP, DOWN
_button_mapping = {
LEFT: (Quartz.kCGMouseButtonLeft, Quartz.kCGEventLeftMouseDown, Quartz.kCGEventLeftMouseUp, Quartz.kCGEventLeftMouseDragged),
RIGHT: (Q... |
data_prepare.py | import sys
sys.path.append("../../Utils")
sys.path.append("../../Cleaner")
sys.path.append("../../Scraper/src")
import random
from nltk.stem.porter import PorterStemmer
import pickle
from data_entry_structures import DataSet, SENETWordPairRaw
from dict_utils import collection_to_index_dict, invert_dict
from cleaner im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.