source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
client.py | import sqlite3
from pprint import pprint
import json
from pathlib import Path
from time import perf_counter, sleep
import multiprocessing as mp
#from multiprocessing import Pipe, Process
#from multiprocessing.connection import Connection
from multiprocessing.connection import Connection
from enum import Enum
from colle... |
test.py | from contextlib import contextmanager
from ctypes import cdll
from ctypes.util import find_library
import datetime
import functools
import hashlib
import hmac
import os
import socket
import sqlite3
import tempfile
import threading
import unittest
import urllib.parse
import uuid
import httpx
from sqlite_s3_query impor... |
test_tx_message.py | import logging
import os
import random
import threading
from typing import List, Tuple, Callable
import pytest
import time
from loopchain import configure
from loopchain.baseservice.tx_message import TxItem, TxMessages, TxMessagesQueue
from loopchain.blockchain import ExternalAddress, Transaction
from loopchain.block... |
views.py | from django.shortcuts import render
# Create your views here.
from rest_framework import viewsets # add this
from .serializers import RegSerializer # add this
from .models import reg # add this
from django import http
from .genetic_algorithm.Optimization2 import Controller
from ... |
async_script.py | """
Display output of a given script asynchronously.
Always displays the last line of output from a given script, set by
`script_path`. If a line contains only a color (/^#[0-F]{6}$/), it is used
as such (set force_nocolor to disable). The script may have parameters.
Configuration parameters:
force_nocolor: if tr... |
mp.py | '''
This module provides a parallelized map function
'''
from multiprocessing import Process, Queue, cpu_count
try:
import mkl
_HAS_MKL = True
except ImportError:
_HAS_MKL = False
class ParmapError(Exception):
def __init__(self,errors):
msg = 'errors were raised when evaluating parmap:\n'
for i,e... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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 witho... |
train_ac_f18.py | """
Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam
Adapted for CS294-112 Fall 2018 by Soroush Nasiriany, Sid Reddy, and Greg Kahn
"""
import numpy as np
import tensorflow as tf
import gym
import logz
import os
import... |
artifacts.py | import hashlib
import json
import mimetypes
import os
from six.moves.urllib.parse import quote
from copy import deepcopy
from datetime import datetime
from multiprocessing import RLock, Event
from multiprocessing.pool import ThreadPool
from tempfile import mkdtemp, mkstemp
from threading import Thread
from time import ... |
thread_delegating_executor.py | # Copyright 2019, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
hydro_utils.py | import json
import os
import re
import zipfile
import datetime as dt, datetime
from typing import List, Union
import geopandas as gpd
import pickle
import smtplib
import ssl
from collections import OrderedDict
import numpy as np
import urllib
from urllib import parse
from dateutil import tz
import requests
import matp... |
app_utils.py | #!/usr/bin/env python
# From http://www.pyimagesearch.com/2015/12/21/increasing-webcam-fps-with-python-and-opencv/
import struct
import six
import collections
import cv2
import datetime
import subprocess as sp
import json
import numpy
import time
import os
import requests
import socket
import sys
from threading import... |
TesterPresentContainer.py | #!/usr/bin/env python
__author__ = "Richard Clubb"
__copyrights__ = "Copyright 2018, the python-uds project"
__credits__ = ["Richard Clubb"]
__license__ = "MIT"
__maintainer__ = "Richard Clubb"
__email__ = "richard.clubb@embeduk.com"
__status__ = "Development"
from uds.uds_config_tool.SupportedServices.iContainer i... |
AGraphCommon.py | """@file AGraphCommon.py
**AGraphCommon.py** is a common definitions file
this file is imported in almost all others files of the program
"""
import math
import time
from Settings import *
import inspect
from threading import Thread
from functools import wraps
from Queue import Queue
import uuid
import sys
#from enum... |
scion_elem.py | # Copyright 2014 ETH Zurich
#
# 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, sof... |
ssh.py | from __future__ import absolute_import
from __future__ import division
import inspect
import logging
import os
import re
import shutil
import six
import string
import sys
import tarfile
import tempfile
import threading
import time
import types
from pwnlib import term
from pwnlib.context import context
from pwnlib.log... |
callbacks.py | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 30 15:17:38 2021
@author: Korean_Crimson
"""
import json
import datetime
from collections import Counter
import tkinter as tk
import threading
import socket
from gui import app, root, config
from network import client, util, server
def set_error(*_):
"""Callback for... |
mapreduce.py |
import os
import argparse
from threading import Thread
import argparse
from yolov3.utils.utils import load_classes
class GenericInputData(object):
def read(self):
raise NotImplementedError
@classmethod
def generate_inputs(cls, config):
raise NotImplementedError
class PathInputDa... |
phila_site_scraper.py | import os
import re
import sys
import json
import time
import uuid
import signal
import hashlib
import smtplib
import logging
import errno
import threading
from urllib.parse import urlparse
from logging.config import dictConfig
from email.mime.text import MIMEText
from queue import PriorityQueue
from datetime import da... |
server_v23.py | import socket
from threading import Thread
from lesson23.client_context_v23 import ClientContextV23
from lesson23.request_v23 import RequestV23
class ServerV23:
@classmethod
def is_verbose(clazz):
return False
def __init__(
self,
state_machine,
host="0.0.0.0",
port... |
utils.py | # Copyright 2012-present MongoDB, 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 wri... |
server.py | #WebSocket Server
import os
from os import listdir
from os.path import isfile, join
import asyncio
import time
import random
import websockets
import posixpath
import mimetypes
import base64
from http import HTTPStatus
from messages_pb2 import Message, Algorithm
import google.protobuf.json_format as json_format
import ... |
scheduler.py | import time
import sched
import threading
class Scheduler:
def __init__(self):
self.scheduler = sched.scheduler()
def schedule_event(self, delay, priority, callback):
self.scheduler.enter(delay, priority, callback)
def worker(self):
try:
while True:
s... |
sparse.py | """
Classes for doing the spatial analysis of clouds of points embedded in a dense array.
This methodology allows to handle with irregular domains in 2D and 3D and multivariate cases.
# Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry)
# Date: 12.03.16
"""
__author__ = 'martinez'
import gc
fro... |
gdal2tiles.py | # -*- coding: utf-8 -*-
# ******************************************************************************
# $Id$
#
# Project: Google Summer of Code 2007, 2008 (http://code.google.com/soc/)
# Support: BRGM (http://www.brgm.fr)
# Purpose: Convert a raster into TMS (Tile Map Service) tiles in a directory.
# ... |
CARAE.py | import numpy as np
import tensorflow as tf
import numpy as np
import threading
from itertools import compress
class ARAE():
def __init__(self,
vocab_size,
batch_size=20,
latent_size=100,
sample_size=100,
property_task=1):
... |
train_LAI.py | #!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import argparse
import glob
import os
import random
import signal
import time
import torch
from pytorch_pretrained_bert import BertConfig
import distributed
from models import data_loader, model_builder
from models.data_loader i... |
admin_command.py | import os
import sys
import threading
import time
from telegram import ReplyKeyboardRemove
from config import bot_cfg
from . import keyboard_cmds, updater
from . import restrict_access
# This needs to be run on a new thread because calling 'updater.stop()' inside a
# handler (shutdown_cmd) causes a deadlock because... |
interface.py | from drone_controller import Drone
import time, os, sys
from threading import Thread
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/lib")
import cflib
from cflib.crazyflie import Crazyflie
"""
Initializer class to establish drone-radio data link
"""
class interfacer:
def _controller(self):
... |
util.py | import sys, json
from collections import defaultdict
from socket import socket
from threading import Thread
def start_daemon_thread(target):
t = Thread(target=target)
t.daemon = True
t.start()
def stream_is_binary(stream):
return 'b' in stream.mode
def find_free_port(host=''):
# ref: https://sta... |
logweb100.py | #!/usr/bin/env python
import os
import re
import sys
import struct
import time
from threading import Thread
import procweb100 as w
w.loadheader()
cids_last = None
match = sys.argv[1:5]
outdir = sys.argv[5]
period = float(sys.argv[6])
def logcid(cid,outfile,period):
END_OF_HEADER_MARKER="----End-Of-Header---- -1... |
operators.py | import json
import bpy
import os
from bpy.types import Operator
from . import utils
from .assets.scripts.evertims import ( Evertims, evertUtils )
# to launch EVERTims raytracing client
import subprocess
# ---------------------------------------------------------------
# import components necessary to report EVERTims ... |
AVR_Miner.py | #!/usr/bin/env python3
##########################################
# Duino-Coin Python AVR Miner (v2.5.6)
# https://github.com/revoxhere/duino-coin
# Distributed under MIT license
# © Duino-Coin Community 2019-2021
##########################################
# Import libraries
import sys
from configparser import ConfigPa... |
5.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import threading
def doubler(number):
"""
可以被线程使用的一个函数
"""
print(threading.currentThread().getName() + '\n')
print(number * 2)
print()
if __name__ == '__main__':
for i in range(5):
my_thread = threading.Thread(target=doubler, args=(i,))
... |
API.py | from flask import Flask
from flask import request
from waitress import serve
import json
import sys
import numpy as np
import time
import multiprocessing as mp
import os
print(os.getcwd())
print(os.listdir("."))
from checkers.src.game.Board import Board
from checkers.src.game.Game import Game
from checkers.src.game.G... |
queue.py | '''The play queue.'''
from os import path, listdir, makedirs, remove, utime
from time import time, localtime
import shlex
from subprocess import run
from threading import Thread, Lock
import click
from youtube_dl import YoutubeDL, utils
from fediplay.cli import options
import fediplay.env as env
class Queue(object... |
main_loop.py | import multiprocessing as mp
import subprocess
import time
import os
import signal
import logging
import setproctitle
from statusbar_utils import display_status_bar
from common_utils import kill_all, exec_command
from volume_utils import store_current_volume, restore_volume, set_volume_to_max
cmd_dialog = 'osascrip... |
file_pusher.py | import collections
import os
import shutil
import threading
import time
from six.moves import queue
import warnings
import tarfile
import wandb
import wandb.util
from wandb.compat import tempfile
def resolve_path(path):
try:
from pathlib import Path
return str(Path(path).resolve())
except:
... |
basic_gpu_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... |
frame_handler.py | import pubsub
import numpy as np
import threading
from .listen_default import listen_default
from .pub_cam import pub_cam_thread
if False:
from typing import Union, Tuple, Any, Callable
def frame_handler_loop(cam_id, # type: Union[int, str]
frame_handler, # type: Callable[[np.ndarray, in... |
conftest.py | # ***************************************
# |docname| - pytest fixtures for testing
# ***************************************
#
# To get started on running tests, see tests/README.rst
#
# These fixtures start the web2py server then submit requests to it.
#
# **NOTE:** Make sure you don't have another server running, ... |
p4runtime.py | # Copyright 2019 Barefoot Networks, 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... |
labels.py | import hashlib
import requests
import threading
import json
import sys
import traceback
import base64
import electrum_ltc as electrum
from electrum_ltc.plugins import BasePlugin, hook
from electrum_ltc.i18n import _
class LabelsPlugin(BasePlugin):
def __init__(self, parent, config, name):
BasePlugin.... |
test_queue.py | # Some simple queue module tests, plus some failure conditions
# to ensure the Queue locks remain stable.
#from __future__ import with_statement
from gevent import monkey; monkey.patch_all()
from gevent import queue as Queue
import threading
import time
import unittest
import test_support
QUEUE_SIZE = 5
# A thread to... |
loadgen.py | """
Copyright 2017 BlazeMeter 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, softwar... |
scene.py | from zombie.physics import Transform,Vector2D,Scalar
from zombie.components import SpriteRenderer,TransformComponent,ScriptComponent
from zombie.script import ScriptManager
from zombie.core import GameView
import threading
class Scene:
def __init__(self, children=[], camera=None,screen=None):
self._children... |
test_storage_pool.py | import time
import threading
import unittest
from pyramid import testing
from kinto.core.testing import skip_if_no_postgresql
@skip_if_no_postgresql
class QueuePoolWithMaxBacklogTest(unittest.TestCase):
def setUp(self):
from kinto.core.storage.postgresql.client import create_from_config
self.co... |
recording_manager.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
rtplot.py | import PySide as ps
import pyqtgraph as pg
import collections
import time, datetime
import numpy as np
import logging as log
import threading
class WatchVariable:
def __init__(self, value_buffer_size=100, name='To Be Filled by O. E. M.', address=None):
self.buf_size = value_buffer_size
self.name ... |
main.py | import json
import time
import threading
import paho.mqtt.client as mqtt
from datetime import datetime, timedelta
from config import *
CAR_NO_VEHICLE = 1
CAR_VEHICLE_LOADS = 2
CAR_WAITING_FOR_VEHICLE = 3
CAR_CHARGE_FINISHED = 4
g_mode = 1 # Auto-Charge 1...On 2...On without Stopping Chargin 0...Off
g_fl... |
database.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""
These tests check the database is functioning properly,
both in memory and in its file
"""
import datetime
import func... |
connection.py | import logging
import serial
import threading
from .packet import Packet, EventPacket
from .util import ResultMatcher, WorkerThread
log = logging.getLogger(__name__)
class TimeoutException(Exception):
pass
class SerialConnection(object):
def __init__(self, device="", baudrate=115200, timeout=1, event_ca... |
relay_integration.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... |
tasks.py | import os
import signal
import psutil
from celery import task
from billiard import Process
from django.core.cache import cache
from econ import TelnetClient
@task()
def telnet_client(server_id, port):
key = 'server-{0}-pid'.format(server_id)
pid = cache.get(key)
if pid and pid in psutil.get_pid_list():
... |
htcondor_utils.py |
#=== Imports ===================================================
import re
import time
import threading
import random
import multiprocessing
import tempfile
import functools
import traceback
import xml.etree.ElementTree as ET
try:
import subprocess32 as subprocess
except Exception:
import subprocess
try:
... |
core.py | # #!/usr/bin/env python
# -*- coding: utf-8 -*-
# <HTTPretty - HTTP client mock for Python>
# Copyright (C) <2011-2018> Gabriel Falcao <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 d... |
main.py | # Local
import user as user_module
import channel as channel_module
import message as message_module
import os
import flask
import discord
from threading import Thread
from functools import partial
from discord.ext import commands
from dotenv import load_dotenv
# =========================== SETUP ===================... |
TestOnMultiProcess.py | import multiprocessing
import time, datetime
import os
def function1():
for i in range(5):
time.sleep(2)
print(f'this is in thread 1, the cycle number is {i} \n')
def function2():
for i in range(5):
time.sleep(2)
print(f'this is in thread 2, the cycle number is {i} \n')
def e... |
dns_hole.py | import socketserver as SocketServer, threading, time
import socket
from ast import literal_eval
import binascii
from dnslib import *
import sys
from colorama import Fore, init
from time import sleep
ag=False # aggressive mode flag
'''
ThreadedUDPRequestHandler: Handles DNS Requests according to Blocklist and User Pr... |
__init__.py | import builtins
import contextlib
import errno
import glob
import importlib.util
from importlib._bootstrap_external import _get_sourcefile
import marshal
import os
import py_compile
import random
import shutil
import stat
import subprocess
import sys
import textwrap
import threading
import time
import unittest
from uni... |
test_grpc_server_registry.py | import sys
import threading
import time
import pytest
from dagster import file_relative_path, pipeline, repository
from dagster.core.errors import DagsterUserCodeProcessError
from dagster.core.host_representation.grpc_server_registry import ProcessGrpcServerRegistry
from dagster.core.host_representation.origin import... |
test_arrow.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 applic... |
optocamp_widget.py | import concurrent.futures
import os
import time
from pathlib import Path
import numpy as np
import pyfirmata2
from qtpy import QtCore
from qtpy import QtWidgets as QtW
from qtpy import uic
from qtpy.QtGui import QIcon
from skimage import io
from .qmmcore import QMMCore
ICONS = Path(__file__).parent / "icons"
UI_FILE... |
batch_ops_test.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 applica... |
test_smtplib.py | import asyncore
import base64
import email.mime.text
from email.message import EmailMessage
from email.base64mime import body_encode as encode_base64
import email.utils
import hmac
import socket
import smtpd
import smtplib
import io
import re
import sys
import time
import select
import errno
import textwrap
import uni... |
background.py | from __future__ import absolute_import
from threading import Thread, Event
from apscheduler.schedulers.base import BaseScheduler
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.util import asbool
class BackgroundScheduler(BlockingScheduler):
"""
A scheduler that runs in the bac... |
Controller.py | import time
from concurrent.futures import ThreadPoolExecutor
from multiprocessing import Queue, Process
from controlling.AsyncProcessor import AsyncProcessor
from controlling.Binding import Binding
from controlling.Config import Config
from controlling.Logger import Logger
from controlling.processMessages import GOAL... |
shallow_detector.py | import cv2
import numpy as np
import os
import time
import threading
#import gestureCNN as myNN
minValue = 70
x0 = 400
y0 = 200
height = 200
width = 200
saveImg = False
guessGesture = False
visualize = False
kernel = np.ones((15,15),np.uint8)
kernel2 = np.ones((1,1),np.uint8)
skinkernel = cv2.getStructuringElemen... |
tomorrow.py | import requests, threading,time,datetime
from src.libraries.config import APIKeys
from src.libraries.weather import WeatherInfo
APIKEY = APIKeys['tomorrow']
class WeatherData:
"""
Params:
*coords (tuple *float[2])
Example:
(29.21,-95.37)
kwargs.units (string)
... |
utils.py | import inspect
import logging
import os
import shlex
import subprocess
import threading
import time
from contextlib import contextmanager
from functools import wraps
import parsl
from parsl.version import VERSION
logger = logging.getLogger(__name__)
def get_version():
version = parsl.__version__
work_tree =... |
__init__.py | #####################################################################
# #
# /__init__.py #
# #
# Copyright 2013, Monash University ... |
invoker.py | """Abstraction for invoking AWS APIs (a.k.a. operations) and handling responses."""
import logging
from queue import Queue
from threading import Thread
import botocore
from opinel.utils.credentials import read_creds
import config
import progress
import store
from tqdm import *
LOGGER = logging.getLogger(__name__)
... |
run_websocket_servers.py | from multiprocessing import Process
import argparse
import os
import syft as sy
from syft.workers.websocket_server import WebsocketServerWorker
import torch
from goodDataML.learning.testnet.utils import get_config_file
hook = sy.TorchHook(torch)
def start_proc(participant, kwargs): # pragma: no cover
"""
... |
test_utility.py | import threading
import pytest
from base.client_base import TestcaseBase
from base.utility_wrapper import ApiUtilityWrapper
from utils.util_log import test_log as log
from common import common_func as cf
from common import common_type as ct
from common.common_type import CaseLabel, CheckTasks
from common.milvus_sys im... |
net.py | """
Handles P2P connections.
All networking functions are ultimately done through
this class.
"""
import hashlib
import signal
import zlib
from ast import literal_eval
from .nat_pmp import NatPMP
from .rendezvous_client import *
from .unl import UNL
from .upnp import *
# How many times a single message can be retran... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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 witho... |
__init__.py | from signal import pause
from gpiozero import Button, LED
from time import sleep, monotonic
from threading import Thread
#
# Sample X times before id'ing
#
SAMPLES = 6
#
# These are the calibrated timing values
#
IDS = [2, 6, 9, 13, 27, 63, 92]
####################
# Simple RC Circuit
# R = 2.2k
# C = uF ID
###... |
test_bz2.py | from test import support
from test.support import bigmemtest, _4G
import unittest
from io import BytesIO, DEFAULT_BUFFER_SIZE
import os
import pickle
import glob
import tempfile
import pathlib
import random
import shutil
import subprocess
import threading
from test.support import unlink
import _compression
import sys
... |
manager.py | #!/usr/bin/env python3
import datetime
import importlib
import os
import sys
import fcntl
import errno
import signal
import shutil
import subprocess
import textwrap
from common.op_params import opParams
from common.is_shane import is_shane
import time
import traceback
from multiprocessing import Process
from typing im... |
generate_qrcode.py | #!/usr/bin/env python3
import pyqrcode
import multiprocessing
import argparse
from pymongo import MongoClient
from pymongo.errors import DuplicateKeyError
from pymongo.errors import CursorNotFound
from datetime import datetime
def connect(host):
return MongoClient('mongodb://{}:27017'.format(host))
def retri... |
wsdump.py | #!/home/raj/django-docker-aws/env/bin/python3
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_encoding():
encoding = geta... |
test_thread_lock.py | from threading import Thread
import pytest
from polog.handlers.file.locks.thread_lock import ThreadLock
def test_threads_race_condition():
"""
Проверяем, что если лок включен - он работает.
"""
iterations = 500000
number_of_threads = 4
lock = ThreadLock(on=True)
index = 0
def increm... |
main.py | import datetime
import json
import threading
import time
from tkinter import *
from tkinter import messagebox
from tkinter.ttk import *
import cv2
import PIL.Image
import PIL.ImageTk
import extract_audio
import file_handler
import imutils
import pygame
import requests
import svtplaywrapper
START_TIME = 0
WIDTH_VIDEO... |
miniterm.py | #!/home/jrwmacedo/MyProjects/Micropython/Pycharm/MQTT/venv/bin/python
#
# Very simple serial terminal
#
# This file is part of pySerial. https://github.com/pyserial/pyserial
# (C)2002-2015 Chris Liechti <cliechti@gmx.net>
#
# SPDX-License-Identifier: BSD-3-Clause
import codecs
import os
import sys
import threading
... |
manager.py | # -*- coding: utf-8 -*-
"""
:copyright: (C) 2010-2013 by Contrail Consortium.
"""
from threading import Thread
from Queue import Queue
from cloudgroups import CloudGroups
from conpaas.core.expose import expose
from conpaas.core.manager import BaseManager
from conpaas.core.https.server import HttpJsonResponse
fro... |
pg_process.py | import multiprocessing as mp
import signal
import queue
from time import sleep, time
import pyqtgraph as pg
from PyQt5 import QtGui
class PGProcess:
def __init__(self, updater, max_freq=60):
self._queue = mp.Queue()
self._exit_event = mp.Event()
args = (
self._queue,
... |
logger.py | # SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source... |
remote_runner_rpc.py | import array
import time
import numpy as np
import mlperf_loadgen as lg
import threading
from queue import Queue
import math
import basic_pb2
import basic_pb2_grpc
import grpc
import cli_colors
import pickle
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger("main")
class Item:
""... |
test_mysqlx_pooling.py | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0, as
# published by the Free Software Foundation.
#
# This program is also distrib... |
FileHandlerFault.py | from Faults import InfraFault
import time
from multiprocessing import Process ,Queue
import glob
import os,signal
import psutil
from Faults import FaultStatus
import subprocess
import sys
import logging
log = logging.getLogger("python_agent")
"""
This is class used to inject the file handler leak fault... |
PipelineManager.py | import logging
import logging.handlers
import queue
from multiprocessing import JoinableQueue, Process, active_children
from time import sleep
# IMPORTS FOR TYPE HINTING
from typing import Callable, List, Optional, Type, Union
class PipelineManager:
"""
Class encapsulating multiprocessing library in Python... |
recorder.py | import os
import time
import wave
import threading
import logging
import cv2
import ffmpeg
from utils import Mutex
import settings
if settings.RECORD_AUDIO:
import pyaudio
class Recorder:
def __init__(self, camera):
self.video = VideoRecorder(camera, self.video_frame_written)
self.audio = A... |
dump_parser.py | from bz2 import BZ2File
from pathlib import Path
from queue import Queue
from threading import Thread
from typing import Any, Callable, Dict, Iterator, List, Tuple
from xmltodict import parse as xmltodict_parse
def parse(dump: Path) -> Iterator[Dict[str, Any]]:
def filter(path: List[Tuple[str, Dict[str, str]]], ... |
netcdf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test NetCDF driver support.
# Author: Frank Warmerdam <warmerdam@pobox.com>
#
############################################################... |
core.py | # Copyright 2021 DeepMind Technologies 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
manager.py | import json
import queue
import threading
import time
import django.utils.timezone as timezone
import lib.digest as digest
import packager.local_repository
import packager.path
import packager.slack
from lib.singleton import Singleton
from manager.models import Build, Artifact
from packager.builder import Builder, Bu... |
SquidNet2Admin.py | import socket, threading, os, sys, urllib.request, sqlite3, time
class Admin:
def logo(self):
logo = """
/\\
//\\\\
//__\\\\
//____\\\\
\... |
Grab_proxy_xundaili_wb.py | import requests
import json
import time
import datetime
from threading import Thread
from RedisClient import RedisClient
from logconfig import LogConfig
import logging
from logging.config import dictConfig
config = LogConfig(info_file=r'grabInfo.log', err_file=r'grabErr.log').log_config
logging.config.dictConfig(confi... |
run_designs.py | #!/usr/bin/env python3
# Copyright 2020 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
multithreading.py | # A DECORATOR FOR PYTHON THREADING
# http://docs.python.org/2/library/threading.html#thread-objects
# http://stackoverflow.com/questions/18420699/multithreading-for-python-django
from threading import Thread
def start_new_thread(function):
"""
if running Django relational database transactions,
include thi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.