source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
speaker.py | # noinspection PyUnresolvedReferences
"""Module for speaker and voice options.
>>> Speaker
"""
import os.path
import re
import sys
from datetime import datetime
from threading import Thread
from typing import NoReturn, Union
import pyttsx3
import requests
import yaml
from playsound import playsound
from executors.l... |
worker.py | import os
import argparse
import pickle
import time
import zmq
from legacypipe.oneblob import one_blob
def run(server):
cluster = os.environ.get('SLURM_CLUSTER_NAME', '')
jid = os.environ.get('SLURM_JOB_ID', '')
aid = os.environ.get('SLURM_ARRAY_TASK_ID', '')
ajid = os.environ.get('SLURM_ARRAY_JOB_I... |
djqueue.py | # Import Libraries
import asyncio
import threading
import discord_bot.discord_bot as discord_bot
from twitchbot import BaseBot
import json
import log_system
def DiscordBot(secrets):
logger.info("Started Discord Thread")
discordloop = asyncio.new_event_loop()
asyncio.set_event_loop(discordloop)
asyncio... |
main_1.py | from __future__ import print_function
import time
import numpy as np
import sys
import os
from random import shuffle
from multiprocessing import Queue
from PIL import Image
sys.path.append('..')
from openbci import wifi as bci
import numpy as np
import glob
import matplotlib.pyplot as plt
from multiprocessing import P... |
sim800l.py | from time import strftime as now
import threading
import serial
FORMAT = '%Y-%m-%d %H:%M:%S'
ser = serial.Serial('COM4', baudrate=57600)
def log(data, file='sim800.log'):
with open(file, 'a+') as f:
f.write(now(FORMAT) + ' ' + str(data) + '\n')
f.close()
def read_from_port(ser):
while True:
... |
subprocess_server_test.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... |
backtester_coin_vj.py | import os
import sys
import sqlite3
import pandas as pd
from matplotlib import pyplot as plt
from multiprocessing import Process, Queue
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
from utility.setting import DB_BACKTEST, DB_COIN_TICK
from utility.static import now, strf_time, timedelta_... |
all_reduce_train.py | #!/usr/bin/env python
import os
import torch
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from math import ceil
from random import Random
from torch.multiprocessing import Process
from torch.autograd import Variable
from torchvision import datasets... |
downsamples.py | #!/usr/bin/python2.7
from __future__ import division
import os
import sys
from multiprocessing import dummy as mp
from multiprocessing import Lock
from mutex import mutex
from copy import copy
import cv2
import rospy
from sensor_msgs.msg import Image
from geometry_msgs.msg import PoseStamped
from cv_bridge import Cv... |
sensing_interface.py | #!/usr/bin/env python
import rospy
import rospkg
import re
import threading
import numpy as np
from threading import Lock
import imp
from rosplan_knowledge_msgs.srv import KnowledgeUpdateServiceArray, KnowledgeUpdateServiceArrayRequest
from rosplan_knowledge_msgs.srv import GetDomainPredicateDetailsService, GetDomainP... |
cpu_bound_multiprocess.py | """ cpu bound single module """
from collections.abc import Generator
import itertools
import time
import multiprocessing as mp
def fibonacci() -> Generator[int, None, None]:
""" generate an infinite sequence of fibonacci numbers """
num_1 = 0
num_2 = 1
yield num_1
yield num_2
while True:... |
clang_format.py | #! /usr/bin/env python
"""
A script that provides:
1. Ability to grab binaries where possible from LLVM.
2. Ability to download binaries from MongoDB cache for clang-format.
3. Validates clang-format is the right version.
4. Has support for checking which files are to be checked.
5. Supports validating and updating a s... |
multiprocessing.py | from __future__ import absolute_import
from __future__ import print_function
import multiprocessing
import threading
import sys
import os
import signal
from six.moves import range
from six.moves import zip
_slave = False
_rank = None
_size = None
_pipe = None
_recv_lock = None
_recv_buffer = []
_print_exceptions = T... |
lmds.py | from pathlib import Path
from threading import Event, Thread, Lock
from queue import Queue, Empty
from signal import signal, SIGINT, SIGQUIT, SIGTERM
# Lock wrapper. Used to aid in migrating to read-write
# locks later.
class LMDSLock:
def __init__(self):
self.lock = Lock()
def acquire(self, blocking=... |
app_action.py | from app_base import *
from app_data import *
import etk_helper
@api.route('/projects/<project_name>/actions/project_config')
class ActionProjectConfig(Resource):
@requires_auth
def post(self, project_name): # frontend needs to fresh to get all configs again
if project_name not in data:
... |
main.py | # Launch of an autonomous robo-advisor
from train import train_agent
from trade import trade_agent
from multiprocessing import Process
from multiprocessing import Lock
from utils import primary_initialization_window_time_rmse
individual_agent_number_0 = 0
individual_agent_number_1 = 1
# Number of workers/agents indivi... |
sensing_interface.py | #!/usr/bin/env python
import rospy
import rospkg
import re
import threading
import numpy as np
from threading import Lock
import imp
from rosplan_knowledge_msgs.srv import KnowledgeUpdateServiceArray, KnowledgeUpdateServiceArrayRequest
from rosplan_knowledge_msgs.srv import GetDomainPredicateDetailsService, GetDomainP... |
example3.py | # ch13/example3.py
import threading
def writer():
global text
while True:
with service:
resource.acquire()
print(f'Writing being done by {threading.current_thread().name}.')
text += f'Writing was done by {threading.current_thread().name}. '
resource.release()
de... |
apparatus.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time
import re
import multiprocessing as mp
from os import path, makedirs, listdir, remove
from shutil import copyfile
from threading import Event
from psyclab.utilities.osc import OSCResponder, route
from psyclab.apparatus.osc_controller import OSCController
f... |
vulcan_ash.py | __all__ = ['SignInWithScreenshot', 'SignInSpeedup']
from typing import List
from requests.exceptions import *
from src.BusinessCentralLayer.coroutine_engine import lsu_
from src.BusinessCentralLayer.setting import logger
class SignInSpeedup(lsu_):
"""็จไบ่ถๆ็ญพๅฐ็่ฝป้ๅๅ็จๅ ้ๆงไปถ"""
def __init__(self, task_docker: Lis... |
roomba.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Python 2.7/Python 3.5/3.6 (thanks to pschmitt for adding Python 3 compatibility)
Program to connect to Roomba 980 vacuum cleaner, dcode json, and forward to mqtt
server
Nick Waterton 24th April 2017: V 1.0: Initial Release
Nick Waterton 4th July 2017 V 1.1.1: Fixed... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
from test import test_support
import asyncore
import socket
import select
import time
import gc
import os
import errno
import pprint
import urllib, urlparse
import traceback
import weakref
import functools
import platform
from BaseHTTPServer import HTT... |
tunnel.py | """Basic ssh tunnel utilities, and convenience functions for tunneling
zeromq connections.
"""
# Copyright (C) 2010-2011 IPython Development Team
# Copyright (C) 2011- PyZMQ Developers
#
# Redistributed from IPython under the terms of the BSD License.
import atexit
import os
import re
import signal
import socket
impor... |
tello_driver_node_old.py | #!/usr/bin/env python2
import rospy
from std_msgs.msg import Empty, UInt8, Bool
from std_msgs.msg import UInt8MultiArray
from sensor_msgs.msg import Image
from geometry_msgs.msg import Twist
from nav_msgs.msg import Odometry
from dynamic_reconfigure.server import Server
# from h264_image_transport.msg import H264Packet... |
database_throughput_test.py | #!/usr/bin/env python3
# Copyright 2017-2019 object_database 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... |
manual_control_test.py | import random
import time
import threading
def inp_handler(name):
from pynput.keyboard import Key, Controller as KeyboardController
keyboard = KeyboardController()
time.sleep(0.1)
choices = ['w', 'a', 's', 'd', 'j', 'k', Key.left, Key.right, Key.up, Key.down]
NUM_TESTS = 50
for x in range(NUM... |
api.py | # -*- coding: utf-8 -*-
"""
api
~~~
Implements API Server and Interface
:author: Feei <feei@feei.cn>
:homepage: https://github.com/wufeifei/cobra
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2017 Feei. All rights reserved
"""
import errno
import json
import... |
base.py | import queue
import threading
import time
import requests
from requests.exceptions import ProxyError
from ..client import InstagramClient
from ..web import get_instagram_id, get_user_info
from ..exceptions import InstagramException
CONNECTION_MAX_ATTEMPTS = 100
class Actions:
followers = 'followers'
follow... |
serve.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import abc
import argparse
import json
import logging
import os
import platform
import signal
import socket
import sys
import threading
import time
import traceback
from six.moves import urllib
import uuid
from collections import defaultdict, OrderedDict
f... |
Hiwin_RT605_ArmCommand_Socket_20190627160850.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import math
import enum
pos_feedback_times = 0
mode_feedback_times = 0
msg_feedback = 1
#ๆฅๆถ็ญ็ฅ็ซฏๅฝไปค ็จSocketๅณ่ผธ่ณๆงๅถ็ซฏ้ป่
ฆ
import socket
##ๅคๅท่กๅบ
i... |
copy_.py | import os
# os.environ["CUDA_VISIBLE_DEVICES"]="-1" # ใณใกใณใใขใฆใใๅคใใจGPUใ็กๅนๅ
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]="0" #GPU
###GeForce GTX 1660 config###
from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession
config = ConfigProt... |
play_song.py | #!/usr/bin/env python3
from gmusicapi import Mobileclient
from gmusicapi import Musicmanager
import re
import os
import threading
import aiy.assistant.auth_helpers
from aiy.assistant.library import Assistant
import aiy.voicehat
from google.assistant.library.event import EventType
import vlc
import time
finish = 0
_... |
ZBlock.py | import time
import threading
import config
from config import *
class ZBlock:
def __init__(self):
self.cells = 4 # Number of cells occupied by the block
config.block_count += 1
config.item_id["blocks"][f"{config.block_count}"] = {} # Add a new key to dictionary to add block IDs
... |
node.py | # Ant
#
# Copyright (c) 2012, Gustav Tiger <gustav@tiger.name>
#
# 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, m... |
test_batchupload.py | # coding: utf-8
import os
import threading
import uuid
from collections import defaultdict
from unittest.mock import patch
from uuid import uuid4
import pytest
import responses
from nuxeo.constants import IDEMPOTENCY_KEY, UP_AMAZON_S3
from nuxeo.exceptions import (
CorruptedFile,
HTTPError,
InvalidBatch,
... |
TFLite_detection_webcam.py |
# Credit: Evan Juras
# Description:
# This program uses a TensorFlow Lite model to perform object detection on a live webcam
# feed. It draws boxes and scores around the objects of interest in each frame from the
# webcam. To improve FPS, the webcam object runs in a separate thread from the main program.
# This... |
__init__.py | # Copyright 2018 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... |
launcher.py | """
Simple experiment implementation
"""
from hops import util
from hops import hdfs as hopshdfs
from hops import tensorboard
from hops import devices
import pydoop.hdfs
import threading
import six
import datetime
import os
run_id = 0
def _launch(sc, map_fun, args_dict=None, local_logdir=False, name="no-name"):
... |
guitarbot.py | import time, os
import cv2
import numpy as np
import matplotlib.pyplot as plt
from pynput.keyboard import Key, Controller
from modules import screenshot
from queue import Queue
from threading import Thread
def PCA(M, k=2):
x1, x2 = M.shape
if (x1 >= x2): M = M.T
R = np.cov(M - mean(M))
lamb, Vy = np.li... |
stubs.py | from pytest import fixture
@fixture(scope="session", autouse=True)
def stub_server(request):
from multiprocessing import Process
from stubilous.server import run
from stubilous.builder import Builder
builder = Builder()
builder.server(host="localhost", port=9998)
builder.route("GET", "/health"... |
__init__.py |
import websocket
import threading
import time
class DanmuClient:
def __init__(self):
self.reg_datas = None
self.ws = None
self.cb = None
def start(self, url, cb):
ws_url, self.reg_datas = self.get_ws_info(url)
self.cb = cb
self.ws = self.connect(ws_url)
... |
main.py | #! /usr/bin/env python
# -*- coding: UTF-8 -*-
import wx
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import os
import time
import threading
import inspect
import ctypes
from run import runcore
from ui import uidef
from ui import uilang
g_main_win = None
g_task_detectUsbhid = None
g_task_uartAllInOneAction =... |
pir.py | #! /usr/bin/env python3
import RPi.GPIO as GPIO
import time
import threading
import blinkt
import colorsys
import numpy as np
from sys import exit
GPIO.setmode(GPIO.BCM)
PIR_PIN = 21
GPIO.setup(PIR_PIN, GPIO.IN)
class Timer():
def __init__(self):
self.started = None
def start(self):
self.star... |
controller.py | from numpy import true_divide
from model import Reminder
from view import ViewBase
import logging
import threading
import time
class Controller():
def __init__(self, reminder, view):
self.reminder_ = reminder
self.view_ = view
# Daemon thread that runs in backround.
se... |
test_flush.py | import time
import pdb
import threading
import logging
from multiprocessing import Pool, Process
import pytest
from utils import *
dim = 128
segment_row_count = 5000
index_file_size = 10
collection_id = "test_flush"
DELETE_TIMEOUT = 60
nprobe = 1
tag = "1970-01-01"
top_k = 1
nb = 6000
tag = "partition_tag"
field_name ... |
code.py | # Released under the MIT License. See LICENSE for details.
#
"""Functionality for formatting, linting, etc. code."""
from __future__ import annotations
import os
import subprocess
import sys
from pathlib import Path
from typing import TYPE_CHECKING
from efrotools.filecache import FileCache
if TYPE_CHECKING:
fro... |
start_server.py | # Copyright (c) 2020, Ford Motor Company, Livio
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# Redistributions of source code must retain the above copyright notice, this
# list of condit... |
test_utils_test.py | import asyncio
import pathlib
import socket
import threading
from contextlib import contextmanager
from time import sleep
import pytest
from tornado import gen
from distributed import Client, Nanny, Scheduler, Worker, config, default_client
from distributed.core import rpc
from distributed.metrics import time
from di... |
test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import threading_helper
from test.support import verbose, cpython_only
from test.support.import_helper import import_module
from test.support.script_helper import assert_python_ok, assert_python_failure
import random
import sys
import _thre... |
test_dota_ms.py | # -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import os
import sys
import tensorflow as tf
import cv2
import numpy as np
import math
from tqdm import tqdm
import argparse
from multiprocessing import Queue, Process
sys.path.append(".... |
kademlia_v05.py | """An upgrade of the previous to provide support for a naive broadcast message type."""
from __future__ import annotations
import socket
from collections import defaultdict
from copy import deepcopy
from concurrent.futures import Future
from datetime import datetime, timezone
from functools import partial
from itert... |
test_local_apigw_service.py | from unittest import TestCase
import threading
import os
import shutil
import json
import time
import requests
import random
from mock import Mock
from samcli.local.apigw.local_apigw_service import Route, LocalApigwService
from tests.functional.function_code import nodejs_lambda, API_GATEWAY_ECHO_EVENT, API_GATEWAY_B... |
manager.py | # -*- coding: utf-8 -*-
#
# profiler : a Wi-Fi client capability analyzer tool
# Copyright : (c) 2020-2021 Josh Schmelzle
# License : BSD-3-Clause
# Maintainer : josh@joshschmelzle.com
"""
profiler.manager
~~~~~~~~~~~~~~~~
handle profiler
"""
# standard library imports
import argparse
import inspect
import logging
... |
brightbar.py | from Adafruit_BBIO.SPI import SPI
#from PIL import Image
from pprint import pprint
from traceback import print_exception
#import numpy
import time
import logging
import threading
import sys
from startup_sequence import startup_sequence
#from gif_animation import GifAnimation
from sparkle_animation import SparkleAnima... |
programs_with_labels.py | # ----------------------------------------------------------------------------------------
# 001.0003-print-hello-world.py
# ----------------------------------------------------------------------------------------
from __future__ import print_function # flat_style (-> +1), imperative_style (-> +1), import:__future__:pr... |
celery_multiprocessing_env.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This is the billiard assertion error, use EVN to avoid it,
In shell: export PYTHONOPTIMIZE=1
Or in python: os.environ["PYTHONOPTIMIZE"] = "1" # the value is of type string
See: https://github.com/celery/celery/issues/1709 for more infomation.
"""
from __future__ impor... |
thread_demo.py | #!/usr/bin/python3
# -*- coding: UTF-8 -*-
import threading
import time
def foo(n):
print("args is %s" %(n))
x = 0
while x < 10:
print("child thread running", x)
time.sleep(1)
x += 1
def fun():
print("other child thread is runing")
if __name__ == '__main__':
# ๅฏๅจไธไธช็บฟ็จ,่ฟ้... |
test_decorators.py | # Copyright 2021 ONDEWO GmbH
#
# 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, ... |
marynarz.py | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import threading
import time
class Marynarz(object):
def __init__(self, szer_drogi= 9, czas = 0.1):
self._pozycja = szer_drogi / 2
self._szer_drogi = szer_drogi
self._blokada = threading.Lock()
self._czas = czas
self._uruch... |
test_client.py | """Tests for the `client` module."""
import json
import os
import signal
import threading
import time
from base64 import b64encode
from copy import deepcopy
import pytest
import requests
from responses import mock as responses
from aria2p import Client, ClientException
from aria2p.client import JSONRPC_CODES, JSONRP... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from cereal import log
from common.params import Params, put_nonblocking
from common.realtime import sec_since_boot
from selfdrive.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
CAR_VOLTAGE_LOW_PASS_K = 0.091 # LPF gain for 5s tau... |
monitornator.py | #!/usr/bin/env python3
agent_version="___AGENT_VERSION___"
from urllib.parse import urlencode
from urllib.request import Request, urlopen
from pathlib import Path
import argparse, sys
import datetime
import psutil
import time, threading
import configparser
config_file_path="/etc/monitornator/monitornator.config"
# ... |
celery_command.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... |
demo3.py | # -*- coding: utf-8 -*-
import threading
import time
import schedule
def job():
print("runing on thread {}".format(threading.current_thread()))
def run_threaded(job_func):
job_thread = threading.Thread(target=job_func)
job_thread.start()
schedule.every(5).seconds.do(run_threaded, job)
schedule.every(5... |
_test_multiprocessing.py | #
# Unit tests for the multiprocessing package
#
import unittest
import unittest.mock
import queue as pyqueue
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 warn... |
tests_common.py | """
Copyright (C) 2021 Jesper Devantier <j.devantier@samsung.com>
NOTE: many test fixtures are split into a _<foo> and a <foo> function.
This split is done to satisfy the type-checker while providing a way
to delay operations until the test itself starts.
In other words, each <foo> function returns ... |
v2rayMS_Server.py | #!/usr/bin/python3
# -*- coding: UTF-8 -*-
import threading
from socketserver import BaseRequestHandler, ThreadingTCPServer
import queue
import time
import v2server
'''
@Author : Npist <npist35@gmail.com>
@File : v2rayMS_Server.py
@License : http://opensource.org/licenses/MIT The MIT License
@Link : htt... |
app.py | #!/usr/bin/python
########################################################
__author__ = 'Theophilus Siameh'
__author_email__ = 'theodondre@gmail.com'
__copyright__ = 'Copyright (C) 2020 Theophilus Siameh'
__version__ = 1.0
########################################################
from functools import wraps
from bson.o... |
ng.py | #!/usr/bin/env python
#
# Copyright 2004-2015, Martian Software, Inc.
# Copyright 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/license... |
hpds-02-A-01.py | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 7 08:59:27 2020
Contoh Threading sederhana di Python 3
@author: Taufik Sutanto
"""
import threading
def print_cube(num):
print("Cube: {}".format(num * num * num))
def print_square(num):
print("Square: {}".format(num * num))
if __name__ == "__main__":
# crea... |
test_multiprocessing.py | # coding: utf-8
import os
from multiprocessing import Process
# ๅญ่ฟ็จ่ฆๆง่ก็ไปฃ็
def run_proc(name):
print('Run child process %s (%s)...' % (name, os.getpid()))
print('Pid: %s, __name__: %s' % (os.getpid(), __name__))
if __name__ == '__main__':
print('Parent process %s.' % (os.getpid(),))
p = Process(target=r... |
__main__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# MIT License
# Copyright (c) 2020 Stษrry Shivษm // This file is part of AcuteBot
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE A... |
Hiwin_RT605_ArmCommand_Socket_20190627203926.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##ๅคๅท่กๅบ
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
test_queue.py | import unittest
from queue import Empty, Full
from threading import Thread
from extra_foam.pipeline.f_queue import SimpleQueue
class TestSimpleQueue(unittest.TestCase):
def testGeneral(self):
queue = SimpleQueue(maxsize=2)
self.assertTrue(queue.empty())
queue.put_nowait(1)
queue.p... |
logistic_parallel.py | import multiprocessing as mp
import queue
import time
from multiprocessing import sharedctypes
import numpy as np
from numpy import ctypeslib
from scipy.sparse import isspmatrix
from scipy.special import expit as sigmoid
from base_logistic import BaseLogistic
from constants import INIT_WEIGHT_STD
from memory import G... |
test_sigma_dut.py | # Test cases for sigma_dut
# Copyright (c) 2017, Qualcomm Atheros, Inc.
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
logger = logging.getLogger()
import os
import socket
import subprocess
import threading
import time
import hostapd
from utils i... |
lankadeepa.py | import tweepy
import os
import time
import threading
from elasticsearch import Elasticsearch, helpers
from datetime import datetime
from dotenv import load_dotenv
load_dotenv()
consumer_key = os.getenv('consumer_key')
consumer_secret = os.getenv('consumer_secret')
access_key = os.getenv('access_key')
access_secret = ... |
commanding.py | #A* -------------------------------------------------------------------
#B* This file contains source code for the PyMOL computer program
#C* Copyright (c) Schrodinger, LLC.
#D* -------------------------------------------------------------------
#E* It is unlawful to modify or remove this copyright notice.
#F* -------... |
fifo_queue_test.py | # Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
http_server.py | # Copyright 2019 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, ... |
build.py | #!/usr/bin/env python
# -*- coding: utf-8
import logging
import re
import tempfile
from collections import namedtuple
from datetime import datetime
from threading import Thread
from .image import Image
LOG = logging.getLogger(__name__)
FROM_PATTERN = re.compile(r"FROM\s+(?P<name>[\w./-]+)(:(?P<tag>[\w.-]+))?(\s+(?:A... |
test_mp_plugin.py | import sys
from nose2 import session
from nose2.compat import unittest
from nose2.plugins.mp import MultiProcess, procserver
from nose2.plugins import buffer
from nose2.plugins.loader import discovery, testcases
from nose2.tests._common import FunctionalTestCase, support_file, Conn
import multiprocessing
import thread... |
cliIM.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import fbchat ## github fbchat python
from threading import Thread
import sys,time,termios,tty,re,os
import logging, traceback
try:
from termcolor import colored
except:
def colored(text,color):
return text
class dummyExample(): # module example
las... |
USRP_connections.py | ########################################################################################
## ##
## THIS LIBRARY IS PART OF THE SOFTWARE DEVELOPED BY THE JET PROPULSION LABORATORY ##
## IN THE CONTEXT OF THE GPU ACCELERATED FLEXIBLE RA... |
webguioverlay.py | import sys
import win32api, win32con, win32gui, win32ui
import os
from PyQt5 import QtGui, QtCore, uic
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QMainWindow, QDesktopWidget, QApplication, QVBoxLayout, QLabel
from PyQt5.QtGui import QPixmap
from PyQt5.QtWebEngineWidgets import QWebEngineView as QWebView,QW... |
common.py | # Copyright 2021 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 enum import Enum
from functools import wraps
from pathlib import... |
decorators.py | import contextlib
import functools
import sys
import threading
from functools import partial
from typing import Any, Callable, Dict, Optional, Tuple
# import tqdm
from loguru import logger
from tqdm import tqdm as std_tqdm
from tqdm.contrib import DummyTqdmFile
tqdm = partial(std_tqdm, dynamic_ncols=True)
def logger... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
from electrum.bitcoin import TYPE_ADDRESS
from electrum.storage import WalletStorage
from electrum.wallet import Wallet, InternalAddressCorruption
from electrum.paymentrequest import InvoiceStore
fr... |
a2c.py | import os
import torch
import elf
import numpy as np
import wandb
from elf.segmentation.features import compute_rag
from torch.nn import functional as F
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.utils.data import DataLoader
from collections import namedtuple
import matplotlib.pyplot as plt
from ... |
krisself.py | # -*- coding: utf-8 -*-
import KRIS
from KRIS.lib.curve.ttypes import *
from datetime import datetime
import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, ctypes, urllib, urllib2, urllib3, wikipedia, tempfile
from bs4 import BeautifulSoup
from urllib import urlopen
import r... |
MultiGraph.py | import numpy as np
from collections import defaultdict
import time
import torch
from train_models import robotTrain, robotPreTrain
from traversal.NavigableGraph import HNSW
from traversal.Greedy import GreedyTraversal
from utils import parallelize, test_valid
import json
from torch.multiprocessing import Process, Que... |
test_capi.py | # Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
from collections import OrderedDict
import os
import pickle
import random
import re
import subprocess
import sys
import sysconfig
import textwrap
import threa... |
wsdump.py | #!/Users/annethessen/eco-kg/try2/bin/python3
"""
websocket - WebSocket client library for Python
Copyright (C) 2010 Hiroki Ohtani(liris)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Found... |
bad_thread_instantiation.py | # pylint: disable=missing-docstring
import threading
threading.Thread(lambda: None).run() # [bad-thread-instantiation]
threading.Thread(None, lambda: None)
threading.Thread(group=None, target=lambda: None).run()
threading.Thread() # [bad-thread-instantiation]
|
web.py | # Electrum - lightweight Bitcoin client
# Copyright (C) 2011 Thomas Voegtlin
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights t... |
test_storage.py | import time
import random
import threading
from uuid import uuid4
import hiro
import mock
import sys
from limits.strategies import FixedWindowRateLimiter, MovingWindowRateLimiter
from limits.errors import ConfigurationError
from limits.limits import RateLimitItemPerMinute, RateLimitItemPerSecond
from limits.storage i... |
packet.py | # coding=utf-8
__author__ = 'wang.yuanqiu007@gmail.com'
import pickle
import json
import attr
import socket
import threading
from attr.validators import instance_of, optional
from enum import Enum
# The bytes at the end of the packet
EOF = b'\xFF\xFF\x00\x00'
class PacketParseError(Exception):
def __init__(self... |
daqbrokerClient.py | import time
import snowflake
import struct
import serial
import serial.tools.list_ports
import socket as SOCKETS
import zmq
import random
import multiprocessing
import os
import platform
import subprocess
import sys
import traceback
import json
import psutil
import math
import requests
import ftplib
import fnmatch
impo... |
benchmark_image_sizes.py | from pymatting import load_image, show_images, trimap_split
from pymatting import cf_laplacian, make_linear_system
from config import IMAGE_DIR, ATOL, SOLVER_NAMES, SCALES, INDICES
import scipy.sparse.linalg
import numpy as np
import threading
import multiprocessing
import psutil
import time
import json
import os
def... |
queue.py | # coding=utf-8
import time
import threading
from random import random
from Queue import Queue
q = Queue()
def double(n):
return n * 2
def producer():
while 1:
wt = random()
time.sleep(wt)
q.put((double, wt))
def consumer():
while 1:
task, arg = q.get()
print ar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.