source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
adc_worker.py | import busio
import digitalio
import board
import adafruit_mcp3xxx.mcp3008 as MCP
from adafruit_mcp3xxx.analog_in import AnalogIn
import threading
import time
import json
import redis
import importlib
from logger.Logger import Logger, LOG_LEVEL
class ADCMCP3008Worker:
"""
Analog-Digital-Converter Worker
"... |
camera.py | import cv2
import numpy as np
from cropper import Cropper
import threading
import queue
class Camera():
def __init__(self, camera_cfg) -> None:
width, height, fps, calibration, origin_roi, calibrated_roi = camera_cfg["width"], camera_cfg[
"height"], camera_cfg["fps"], camera_cfg["params"], came... |
server.py | #
# Copyright 2022 The AI Flow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
async.py | #!/usr/bin/env python
# encoding: utf-8
"""
async.py - functions for asyncrounous code
Created by Maximillian Dornseif on 2009-02-15.
Copyright (c) 2009 HUDORA. All rights reserved.
parts based on http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/84317
"""
import copy
import logging
import sys
import time
impor... |
speech_input.py | # Copyright 2016 Louis Kirsch. 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 law or... |
sc5.py | #from __future__ import print_function
import os
import sys
import matplotlib
import multiprocessing
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
import IPython
import subprocess
import sys
from subprocess import Popen, PIPE, STDOUT
import graphviz as gv
import json
import networkx ... |
Run_CtaStrategy_NoUI.py | import multiprocessing
from time import sleep
from datetime import datetime, time
from logging import INFO
from vnpy.event import EventEngine
from vnpy.trader.setting import SETTINGS
from vnpy.trader.engine import MainEngine
from vnpy.trader.utility import load_json, send_dingding, send_weixin
from vnpy.gateway.ctp i... |
test_pool.py | # Copyright (c) 2011 Brian Beach
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, ... |
test_decimal.py | # Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz (aahz at pobox.com)
# and Tim Peters
"""
These are the test cases for the Decim... |
test_hbase_regionserver.py | # (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
import threading
import time
import unittest
import os
import mock
# 3p
from nose.plugins.attrib import attr
# project
from aggregator import MetricsAggregator
import logging
log = logging.getLogger('... |
test_io.py | """Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... |
problema.py | from threading import Thread, Lock
import time
import logging
from random import randrange
from sys import argv
mutex = Lock()
sharedBuffer = []
produttoreRunning = True
def thread_produttore(nome, nomefile):
global sharedBuffer
global mutex
global produttoreRunning
logging.info("{} sta partendo ...... |
KinectB_hd.py | #!/usr/bin/env python
import numpy as np
from cv_bridge import CvBridge, CvBridgeError
import rospy
import multiprocessing
from sensor_msgs.msg import Image
import grip_and_record.locate_cylinder as locate_cylinder
import cv2
class KinectB_hd:
def __init__(self):
"""
Class for recording data from... |
_reloader.py | import os
import sys
import time
import subprocess
import threading
from itertools import chain
from werkzeug._internal import _log
from werkzeug._compat import PY2, iteritems, text_type
def _iter_module_files():
"""This iterates over all relevant Python files. It goes through all
loaded files from modules,... |
Proceso.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 24 01:41:22 2020
@author: pi
"""
from datetime import datetime
from time import sleep
from threading import Lock, Thread
import threading
from OrdenPlanificada import OrdenPlanificada
from ConexionBD import ConexionBD
from Senso... |
shareAggr.py | #!/usr/bin/python
# Copyright 2018 Blade M. Doyle
# 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 ag... |
eventlistener.py | from web3.auto import w3
from threading import Thread
import time
import sys
from pprint import pprint
import loghandler
log_handler = loghandler.LogHandler()
class EventListener:
def __init__(self):
self.logger = log_handler.create_logger("eventlistener")
def handle_event(self, event):
ppr... |
test_context.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... |
default.py | from __future__ import absolute_import, division, unicode_literals
import sys,os,requests
from lib import util
from lib import settings
from lib.smoothstreams import chanutils, timeutils, schedule, authutils, skinutils, proxyutils, messageutils
import gc
import atexit
import threading
import time
import requests
impo... |
test.py | # -*- coding: utf-8 -*-
import redis
import unittest
from hotels import hotels
import random
import time
from RLTest import Env
from includes import *
from common import *
# this tests is not longer relevant
# def testAdd(env):
# if env.is_cluster():
# raise unittest.SkipTest()
# r = env
# env.as... |
server.py | import os
import socket
import threading
import argparse
# * Config constatns
HEADER = 4096 # send 4096 bytes each time step
PORT = 4040
SERVER = socket.gethostbyname(socket.gethostname())
ADDR = (SERVER, PORT)
FORMAT = 'utf-8'
ADDR = (SERVER, PORT)
ROOT_DIR = os.path.dirname(os.path.abspath("server.py"))
BUCKETS_FOL... |
guimain.py | # ///////////////////////////////////////////////////////////////
#
# BY: WANDERSON M.PIMENTA
# PROJECT MADE WITH: Qt Designer and PySide6
# V: 1.0.0
#
# This project can be used freely for all uses, as long as they maintain the
# respective credits only in the Python scripts, any information in the visual
# interface ... |
player.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: omi
# @Date: 2014-07-15 15:48:27
# @Last Modified by: AlanAlbert
# @Last Modified time: 2018-11-21 14:00:00
"""
网易云音乐 Player
"""
# Let's make some noise
import os
import random
import subprocess
import threading
import time
from . import logger
from .api imp... |
installwizard.py |
from functools import partial
import threading
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import ObjectProperty, StringProperty, OptionProperty
from kivy.core.window import Window
from kivy.uix.button import Button
from kivy.utils import platform
from kivy... |
test_client.py | import asyncio
from collections import deque
from contextlib import suppress
from functools import partial
import gc
import logging
from operator import add
import os
import pickle
import psutil
import random
import subprocess
import sys
import threading
from threading import Semaphore
from time import sleep
import tra... |
spawning_processes.py | #Spawn a Process – Chapter 3: Process Based Parallelism
import multiprocessing
def myFunc(i):
print ('calling myFunc from process n°: %s' %i)
for j in range (0,i):
print('output from myFunc is :%s' %j)
return
if __name__ == '__main__':
for i in range(6):
process = multiprocessing.Proce... |
sshpwn.py | #!/usr/bin/python3
release = "sshpwn 2.0"
# Copyright (c) 2016 Shawn Pang
# http://shawnpang.com
# Released under the MIT license
# TODO FOR SSHPWN 2.0
# DONE - Multi-threading with execute
# DONE - Make more modules (download (with relative ~, splits "/" takes last as downloadfile name (one param)), upload, shutdow... |
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... |
demo_flight_server.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... |
server.py | import socket
import threading
#those imports where added by luca
from matplotlib import pyplot as plt
import os
from os import path
from PyQt5 import QtWidgets, QtCore
from pyqtgraph import PlotWidget, plot
import pyqtgraph as pg
import sys
from random import randint
import time
from multiprocessing import Proces... |
core.py | import os
from threading import Thread
from contextlib import suppress
from astropy import units as u
from panoptes.pocs.base import PanBase
from panoptes.pocs.observatory import Observatory
from panoptes.pocs.state.machine import PanStateMachine
from panoptes.utils.time import current_time
from panoptes.utils.utils i... |
subliminal_watchdog.py | #!/usr/bin/env python3
import os
import time
import glob
import shutil
import threading
from datetime import timedelta, datetime
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
from babelfish import *
from subliminal import *
import enzyme
watch_dirs = set((os.environ.get('W... |
threadlocal_example.py | # -*- codiing:utf-8 -*-
"""
threadlocal example
"""
__author__="aaron.qiu"
import threading
# 创建全局ThreadLocal对象:
local_school = threading.local()
def process_student():
# 获取当前线程关联的student:
std = local_school.student
print('Hello, %s (in %s)' % (std, threading.current_thread().name))
def process_thread(n... |
observer.py | import difflib
import multiprocessing as mp
import time
import requests
import ujson as json
from artemis_utils import get_logger
from artemis_utils.constants import CONFIGURATION_HOST
from artemis_utils.envvars import REST_PORT
from tornado.ioloop import IOLoop
from tornado.web import Application
from tornado.web imp... |
ChannelFactory_test.py | # Copyright 2015 Ufora 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 i... |
mesh_pool.py | import torch
import torch.nn as nn
from threading import Thread
from models.layers.mesh_union import MeshUnion
import numpy as np
from heapq import heappop, heapify, nlargest
import copy
class MeshPool(nn.Module):
def __init__(self, target, multi_thread=False):
super(MeshPool, self).__init__()
... |
Queue_test.py | # coding: utf-8
#########################################################################
# 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> #
# author yeeku.H.lee kongyeeku@163.com #
# #
# version... |
paral.py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from functools import partial
from threading import Thread
from typing import Callable
from joblib import Parallel, delayed
from joblib._parallel_backends import MultiprocessingBackend
import pandas as pd
from queue import Queue
class Paralle... |
test_viewer.py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/gaogaotiantian/viztracer/blob/master/NOTICE.txt
import shutil
from .cmdline_tmpl import CmdlineTmpl
import json
import multiprocessing
import os
import re
import signal
import socket
import subprocess
imp... |
api_test.py | #!/usr/bin/env vpython
# Copyright 2014 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.
# Disable 'Access to a protected member', Unused argument', 'Unused variable'.
# pylint: disable=W0212,W0612,W0613
# pylint... |
main.py | '''MAIN Module for implementing all functionaties by threading and multiprocessing'''
import const
import threading
import multiprocessing
from sender import Sender
from channel import Channel
from receiver import Receiver
def get_next_powerof2(num):
'''returns next integer of n which is a power of 2'''
powe... |
Prefetcher.py | import threading
import Queue
import time
class Counter(object):
"""A thread safe counter."""
def __init__(self, val=0, max_val=0):
self._value = val
self.max_value = max_val
self._lock = threading.Lock()
def reset(self):
with self._lock:
self._value = 0
def set_max_value(self, max_va... |
feature_shutdown.py | #!/usr/bin/env python3
#
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test bitcoind shutdown."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal, get_rpc_proxy, wa... |
command.py | """
Copyright (c) 2019-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... |
executors.py | import copy
import itertools
import multiprocessing
import os
import signal
import subprocess
import sys
import threading
import warnings
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import TimeoutError as FutureTimeout
from functools import wraps
from typing import TYPE_CHECKING, Any, Call... |
data_preprocessor.py | #!/usr/bin/env python
import wx
import wx.lib.buttons
import wx.lib.agw.customtreectrl as CT
import gettext
import os
import re
import sys
import fcntl
import threading
import Queue
import time
import socket
import struct
import shlex
import signal
import subprocess
import psutil
import pty
import yaml
import datetime... |
backup.py | import os
from shlex import quote
from colorama import Fore
import multiprocessing as mp
from pathlib import Path
from shutil import copyfile
from .utils import *
from .printing import *
from .compatibility import *
from .config import get_config
def backup_dotfiles(backup_dest_path, dry_run=False, home_path=os.path.... |
shell.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from gevent import monkey
#monkey.patch_all()
monkey.patch_all(thread=False)
import logging
import click
import Queue
from abc import abstractmethod
from threading import Thread
from collections import deque
imp... |
test_supervisor.py | import multiprocessing
import os
import signal
import sys
import time
from flaky import flaky
from psutil import Process
from pytest import mark
from setproctitle import setproctitle
from sure import expect
from simpleflow.process import Supervisor, reset_signal_handlers
from tests.utils import IntegrationTestCase
T... |
__init__.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016, ParaTools, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# (1) Redistributions of source code must retain the above copyright notice,
# t... |
http.py | # -*- coding: utf-8 -*-
"""
This module contains some helpers to deal with the real http
world.
"""
import threading
import logging
import select
import socket
import time
import os
import six
import webob
from six.moves import http_client
from waitress.server import TcpWSGIServer
def get_free_port():
s = socke... |
monitor.py | from datetime import datetime
import pytz
import boto
from boto.s3.bucket import Bucket
import re
import os
import arrow
from util import get_logger
from snakebite.client import Client
log = get_logger('inviso-monitor')
job_pattern = re.compile('job_[0-9]+_[0-9]+', re.IGNORECASE)
EPOCH = datetime(1970, 1, 1, tzinfo... |
ex02_semaphore.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from random import random
from threading import Thread, Semaphore
"""
线程同步机制:
- Semaphore(信号量)
- Lock(互斥锁), 相当于: 信号量为1
- RLock(可重入锁):
- acquire() 能够不被阻塞的被同一个线程调用多次。
- 但release()要调用与acquire()相同的次数才能释放锁。
- Condition(条件):
... |
token3.py | from Classclient import LineBot
import json,threading,subprocess
def login(resp, auth):
bot = LineBot(resp, auth)
Znf = threading.Thread(target=login, args=('A1','u94b77722942fc947033dbd1cef34b1a7:aWF0OiAxNTQ3OTY1MzQwNTIyCg==..5HCG7N/NAmHjaS8+h/2UtpRhXkM=')).start()
Znf = threading.Thread(target=login, args=('A2','u4... |
Hiwin_RT605_ArmCommand_Socket_20190627192656.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##多執行序
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
data_process.py | class data_helper:
def __init__(self,file_name,encoding,path=None):
self.file_name= file_name
self.encoding = encoding
def process(self):
# import pandas as pd
# from bs4 import BeautifulSoup
# import tqdm
merged = pd.read_csv(self.file_name,encodin... |
locks.py | import threading, time
from random import random
def f(lock):
current_thread_name = threading.current_thread().getName()
for _ in range(5):
with lock:
print('{} Lock acquired'.format(current_thread_name))
time.sleep(random())
print('{} Lock released'.format(current_thre... |
mailing_list.py | import threading
from mailchimp import Mailchimp, ListDoesNotExistError, EmailNotExistsError, ListAlreadySubscribedError, Error
from django.conf import settings
class SubscribeToMailingList(object):
def __init__(self, email, first_name, last_name):
self.email = email
self.first_name = first_name
... |
recorder.py | import json
import os
import threading
import time
import picamera
import RPi.GPIO as GPIO
def button_pushed(channel):
global lapse, save_path, running, cache_file
if config['debug']:
print('Button on pin {} pushed'.format(channel))
if not running:
lapse += 1
save_path = '{0}/set-{... |
fileSynchronizer.py | #!/usr/bin/python3
#==============================================================================
#description :A minimal command line peer-2-peer file synchronizer
#usage :python fileSynchronizer.py trackerIP trackerPort
#python_version :3.9
#Authors :Danish Khan, Yongyong Wei, Rong Zheng
#===... |
asyn_classical_env_test.py | from multiprocessing import Process, Queue, Pipe
from baselines import deepq
import gym
from deepq.asyn_sec.actor_interact_env import actor_inter
from deepq.asyn_sec.simple_multi_agent import learn
# from deepq.asyn_sec.new_models import mlp
from deepq.models import mlp
# from p2os_test.src.set_actor_num import set_gp... |
recipe-579023.py | # last updated
# 1/28/2015 added sql logging
import sys
import threading
import time
import queue
import csv
from SQLSMO import *
# =============== FUNCTIONS ===========================
def LogSQL(filename, CN, sql):
"""
Appends to given log file the sql executed with this format:
--------------------... |
queues.py | # coding: utf-8
"""
brownie.tests.datastructures.queues
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests for :mod:`brownie.datastructures.queues`.
:copyright: 2010-2011 by Daniel Neuhäuser
:license: BSD, see LICENSE.rst for details
"""
from __future__ import with_statement
from threading import Thread
f... |
SampleService_test.py | # These tests cover the integration of the entire system and do not go into details - that's
# what unit tests are for. As such, typically each method will get a single happy path test and
# a single unhappy path test unless otherwise warranted.
# Tests of the auth user lookup and workspace wrapper code are at the bot... |
10_zmq.py | # -*- coding: utf-8 -*-
#
# conda install -n python3 pyzmq
import unittest
import zmq
import time
import threading
def send_message():
context = zmq.Context()
print("Connecting to zmq-req-resp server...")
socket = context.socket(zmq.REQ)
socket.connect("tcp://127.0.0.1:9876")
for request in rang... |
handlers.py | # Copyright 2001-2013 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... |
hotword_factory.py | # Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
qct.py | from datetime import datetime
import json
import logging
import os
import re
from threading import Thread
import time
from typing import List, Union
from dumpster import fdict
from googleapiclient import discovery
from oauth2client.service_account import ServiceAccountCredentials
from quartz import cue
__all__ = ['... |
main.py | import datetime
from functools import partial
from multiprocessing import *
import os
from queue import Queue
import sys
from time import sleep
from threading import *
from tkinter import *
import tkinter.ttk as ttk
import MetaTrader5 as mt5
# SETTING
IS_ENABLED_TO_WRITE_A_LOG_FILE = False # True if you want to writ... |
test_external_accounts.py | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
server.py | import time
import logging
import socket
import threading
from django.core.management.base import BaseCommand
from apps.accounts import models
from apps.contrib import const
from bots.telegram.client import Client
from bots.utils import Event
logger = logging.getLogger('api')
class Command(BaseCommand):
help = ... |
test_http_client.py | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0.
import awscrt.exceptions
from awscrt.http import HttpClientConnection, HttpClientStream, HttpHeaders, HttpProxyOptions, HttpRequest, HttpVersion
from awscrt.io import ClientBootstrap, ClientTlsContext, DefaultHo... |
train_pg.py | import numpy as np
import tensorflow as tf
import gym
import logz
import scipy.signal
import os
import time
import inspect
from multiprocessing import Process
#============================================================================================#
# Utilities
#====================================================... |
operators.py | # standart modules
import threading
import struct
import os
# blender modules
import bpy
import bmesh
# addon modules
import taichi as ti
import numpy as np
from .engine import mpm_solver
from . import types
from . import particles_io
from . import nodes
WARN_SIM_NODE = 'Node tree must not contain more than 1 "Simu... |
io.py | # Copyright (c) 2018 PaddlePaddle 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 app... |
requests_executor.py | from requests_pkcs12 import Pkcs12Adapter
from pyravendb.commands.raven_commands import GetTopologyCommand, GetStatisticsCommand
from pyravendb.connection.requests_helpers import *
from pyravendb.custom_exceptions import exceptions
from OpenSSL import crypto
from pyravendb.data.document_conventions import DocumentConv... |
client.py |
#!/usr/bin/env python3
"""Script for Tkinter GUI chat client."""
from socket import AF_INET, socket, SOCK_STREAM
from threading import Thread
import tkinter
# crypto imports
# import nacl, nacl.secret, nacl.utils
# from nacl.public import PrivateKey, SealedBox
def receive():
"""Handles receiving of messages."""... |
Dinning_philospher.py | import random
import time
from concurrent.futures import ThreadPoolExecutor
from threading import Lock, Thread, current_thread
sticks = [Lock() for _ in range(5)]
# we put sleep to simulate blocking operation ,so the other thread will enter
def philospher(n):
time.sleep(random.random())
with sticks[n]:
... |
extract_geodata.py | #!/usr/bin/env python3
import argparse
import ipaddress
import multiprocessing
import pandas as pd
from pymongo import MongoClient
from pymongo.errors import DuplicateKeyError
from pymongo.errors import CursorNotFound
from geoip2 import database
from geoip2.errors import AddressNotFoundError
from datetime import da... |
imalcolm.py | #!/dls_sw/prod/tools/RHEL6-x86_64/defaults/bin/dls-python
import logging.config
import threading
import argparse
import atexit
import getpass
import json
import os
import sys
import time
def make_async_logging(log_config):
from malcolm.compat import QueueListener, queue
# Now we have our user specified loggin... |
utils.py | import dataclasses
from typing import Tuple, Optional, List, Any, Sequence
import numpy as np
import torch
from falkon.options import BaseOptions
from falkon.utils import devices, PropagatingThread
from falkon.utils.devices import DeviceInfo
from falkon.utils.fake_queue import FakeQueue
from falkon.utils.tensor_helpe... |
dbx.py | from __future__ import print_function
import base64
import copy
import json
import os
import time
import dropbox
from builtins import object
from builtins import str
from typing import List
from pydispatch import dispatcher
from empire.server.common import encryption
from empire.server.common import helpers
from emp... |
iut_monitoring.py | # Copyright 2020-2021 Axis Communications AB.
#
# For a full list of individual contributors, please see the commit history.
#
# 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... |
mock_empatica_e4.py | #!/usr/bin/env python3
"""
Mock E4 Streaming Server
Source: git@github.com:nirdslab/ee4ss_pretender.git
@author: Ben Mabe, Yasith Jayawardana
"""
import asyncio
import logging
import sys
from asyncio.streams import StreamReader, StreamWriter
from datetime import datetime
from threading import Thread
from typing imp... |
httpclient_test.py | # -*- coding: utf-8 -*-
import base64
import binascii
from contextlib import closing
import copy
import gzip
import threading
import datetime
from io import BytesIO
import subprocess
import sys
import time
import typing # noqa: F401
import unicodedata
import unittest
from tornado.escape import utf8, native_str, to_un... |
test_concurrent_clients.py | import pytest
from jina import Flow, Executor, Client, requests, DocumentArray, Document
from jina.types.request import Response
import threading
import random
import time
from functools import partial
class MyExecutor(Executor):
@requests(on='/ping')
def ping(self, docs: DocumentArray, **kwargs):
ti... |
static.py | import sqlite3
import datetime
import telegram
import pandas as pd
from threading import Thread
from setting import db_stg
try:
connn = sqlite3.connect(db_stg)
df_tg = pd.read_sql('SELECT * FROM telegram', connn)
connn.close()
except pd.io.sql.DatabaseError:
bot = ''
user_id = 0
else:
bot = df_... |
plugin.py | ###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2008-2010, James McCoy
# Copyright (c) 2014, Valentin Lorentz
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistribution... |
__init__.py | """
objectstore package, abstraction for storing blobs of data for use in Galaxy.
all providers ensure that data can be accessed on the filesystem for running
tools
"""
import abc
import logging
import os
import random
import shutil
import threading
import time
from collections import OrderedDict
import yaml
from g... |
y_cable_helper.py | """
y_cable_helper.py
helper utlities configuring y_cable for xcvrd daemon
"""
import threading
import time
from sonic_py_common import daemon_base, logger
from sonic_py_common import multi_asic
from sonic_y_cable import y_cable
from swsscommon import swsscommon
SELECT_TIMEOUT = 1000
y_cable_platform_sfput... |
mp1b.py |
import logging
import multiprocessing
from multiprocessing import Process, freeze_support, Lock, current_process, Value, Array, RawArray, RawValue
import numpy as np
import time
import cv2, imutils
class NP_SharedMemory:
"""
Controls access to shared memory for the main and camera processes
https://resea... |
command_control.py | # coding: utf-8
import sys
from flare.tools.utils import bcolors
from flare.base.config import flareConfig
try:
import pandas as pd
except:
print("Please make sure you have pandas installed. pip -r requirements.txt or pip install pandas")
sys.exit(0)
try:
from elasticsearch import Elasticsearch, help... |
cdc_in_loopback.py | # -*- coding:utf-8 -*-
import serial
import serial.tools.list_ports
import struct
import time
import sys
import random
import threading
import datetime
###############################################################################
#文件设置
###############################################################################
... |
javascript.py | """
domonic.javascript
====================================
- https://www.w3schools.com/jsref/jsref_reference.asp
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
"""
# from typing import *
import sys
import urllib.parse
from dateutil.parser import parse
import datetime
from datetim... |
MusicManagerService.py | import configparser
import json
import threading
import time
import os
import pygame
import requests
from pygame import mixer
from core.Service import Service
from topics.generalstate.GeneralStateChangeNotification import GeneralStateChangeNotification
from topics.generalstate.GeneralStateType import GeneralStateType... |
testprogram.py | #! /usr/bin/python3
# The MIT License (MIT)
#
# Copyright(c) 2021, Damien Feneyrou <dfeneyrou@gmail.com>
#
# 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... |
test_redis_tools.py | # -*- coding: utf-8 -*-
"""
* TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-蓝鲸 PaaS 平台(BlueKing-PaaS) available.
* Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except in co... |
dispatch.py | #!/usr/bin/env python
"""Device -> hw_comm -> dispatch -> plot
-> log
Update minute, hour, day, week, month and year plots.
"""
import hw_comm as dev
import plot
import data
import threading
from os.path import expanduser # find $HOME on any OS
# Logging settings
WORKDIR = expand... |
ui.py | #!/usr/bin/env python
import sys
import os
import subprocess
import platform
import threading
import hyperspeed
import json
try:
import gtk
import gobject
import pango
except ImportError as e:
print e
gtk = False
# import ctypes
# try:
# # ctypes.CDLL("/home/mistika/MISTIKA-ENV/bin... |
__main__.py | import pdb
import json
import sys
import concurrent.futures
import logging
import threading
import pyperf
import six
from six.moves import xrange
EMPTY = ({}, 2000)
SIMPLE_DATA = {'key1': 0, 'key2': True, 'key3': 'value', 'key4': 'foo',
'key5': 'string'}
SIMPLE = (SIMPLE_DATA, 1000)
NESTED_DATA = {'key... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.