source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
multiproc_data.py | from __future__ import print_function
from ctypes import c_bool
import multiprocessing as mp
try:
from queue import Full as QFullExcept
from queue import Empty as QEmptyExcept
except ImportError:
from Queue import Full as QFullExcept
from Queue import Empty as QEmptyExcept
import numpy as np
class MP... |
mavtop.py | from __future__ import print_function
import sys,os
import curses
import time
import threading
from pymavlink import mavutil
from argparse import ArgumentParser
from Vehicle import Vehicle
from Screen import Screen
list = []
def findvehicle(id, list):
for i in range(0, len(list)):
if (id == list[i].sys_id):... |
server_TCP_modified.py | import socket
import threading
host = '127.0.0.1'
port = 9999
sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
sock.bind((host,port))
sock.listen(5)
saved = b''
def tcplink(conn, addr):
global saved
# print(conn, addr)
request = conn.recv(1024)
if request[0:3] ==... |
__init__.py | # -*- coding: utf-8 -*-
"""Miscellaneous helper functions (not wiki-dependent)."""
#
# (C) Pywikibot team, 2008-2017
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id: 7e1c9c15b0d121bbe9e36717aa3be86d42ac86c0 $'
import collections
import g... |
command.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... |
worker.py | # vim: set ts=2 sw=2 tw=99 noet:
import threading
class Worker:
def __call__(self):
while len(self.jobs):
try:
job = self.jobs.pop()
job.run()
except KeyboardInterrupt as ki:
return
except Exception as e:
self.e = e
self.failedJob = job
class WorkerPool:
def __init__(self, numWorkers... |
domotica_server.py |
# -*- coding: utf-8 -*-
import serial
import time
from flask import request
from flask import jsonify
import os
from flaskext.mysql import MySQL
import subprocess
import hashlib
import pyglet
import time
import json as JSON
from subprocess import Popen, PIPE, STDOUT
import collections
import datetime
import locale
im... |
jobqueue.py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... |
DLQ.py | #DRONE LAUNCHER
from flask import Flask, render_template, request, jsonify
from roboclaw import Roboclaw
import time
import socket
try:
from neopixel import *
except ImportError:
print("Failure to load Neoplixels")
import argparse
##import threading
try:
import thermo
except IndexError:
print("Failure ... |
concurrency_test.py | # Copyright 2016 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 ag... |
metered_pipe.py | # RA, 2021-11-05
"""
A Pipe analog that records the timestamps of writes and reads.
NB: May require a call to flush() when done.
"""
import collections
import contextlib
import typing
import queue
import time
import multiprocessing
import matplotlib.pyplot
import pandas
import numpy
import inclusive
import plox
... |
utils.py | # -*- coding:utf-8 -*-
"""
Author:
Weichen Shen,wcshen1994@163.com
"""
import json
import logging
from threading import Thread
import requests
try:
from packaging.version import parse
except ImportError:
from pip._vendor.packaging.version import parse
def check_version(version):
"""Return version of pa... |
http_api_e2e_test.py | #!/usr/bin/env python
# -*- mode: python; encoding: utf-8 -*-
"""End-to-end tests for HTTP API.
HTTP API plugins are tested with their own dedicated unit-tests that are
protocol- and server-independent. Tests in this file test the full GRR server
stack with regards to the HTTP API.
"""
import datetime
import json
imp... |
benchmark.py | """
Benchmark performance of file transfer.
Copyright 2022. Andrew Wang.
"""
from typing import Callable
from time import sleep
from threading import Thread
from queue import Queue
from logging import WARNING, basicConfig
import numpy as np
from click import command, option
from send import send
from receive import re... |
player.py | # coding=utf-8
'''
“闹铃”播放器。可多次调用,前后值相同不会产生影响。
唯一接口:
play(wav_filename)循环播放wav音频(不可为'default')
play('default')播放windows beep声,可以在配置文件beep.conf设置样式(出现win7没有声音的问题,但在播放音乐时有声音,也可能是声卡问题)
play('')不作变化
play(None)停止
此外还可以用win32自带系统声音:
'SystemAsterisk' Asterisk
'SystemExclamation' Exclamation
'SystemExit' Exit Windows
'SystemH... |
directoryBuster.py | import requests
import argparse
import threading
from urllib3.exceptions import InsecureRequestWarning
from collections import deque
from queue import Queue
class DirectoryBuster:
def __init__(self):
super().__init__()
requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
... |
training.py | import torch
torch.manual_seed(0)
from torch import nn
import torch.multiprocessing as mp
import torch.utils.data
from torch.autograd import Variable
import numpy as np
from os import path
import os
from model import FCNSG,LRSG
from dataset import get_dataset
import pdb
import argparse
import time
from os.path import ... |
test_workflow_event_processor.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... |
algo_one.py | from functools import reduce
from sys import *
import numpy as np
import random as r
import socket
import struct
import subprocess as sp
import threading
from threading import Thread
import ast
import time
import datetime as dt
import os
import psutil
from netifaces import interfaces, ifaddresses, AF_INET
import paho.m... |
futures.py | """
Support for Futures (asynchronously executed callables).
If you're using Python 3.2 or newer, also see
http://docs.python.org/3/library/concurrent.futures.html#future-objects
Pyro - Python Remote Objects. Copyright by Irmen de Jong (irmen@razorvine.net).
"""
from __future__ import with_statement
import sys
impor... |
log_stream.py | import logging
import os
import threading
import zookeeper
import sys
from twisted.internet import reactor
logger = logging.getLogger(__name__)
_installed = False
_relay_thread = None
_logging_pipe = None
def _relay_log():
global _installed, _logging_pipe
r, w = _logging_pipe
f = os.fdopen(r)
lev... |
backfinder_tick.py | import os
import sys
import sqlite3
import pandas as pd
from multiprocessing import Process, Queue
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
from utility.setting import db_tick, db_backfind
from utility.static import now, strf_time
class BackFinderTick:
def __init__(self, q_, co... |
test_subprocess.py | """Unit tests specifically for the components of SubprocessWorker.
End-to-end tests (e.g. does SubprocessWorker properly implement the
WorkerBase API) still live in `test_worker`.
"""
import functools
import os
import sys
import textwrap
import threading
import typing
from torch.testing._internal.common_utils import... |
find_face.py | #coding:utf-8
import datetime
from itertools import count
import os
import re
import shutil
import time
import face_recognition
import cv2
import matplotlib.pyplot as plt
import sys
from PIL import Image, ImageDraw
from pathlib import Path
import random
import dlib
from concurrent.futures import ThreadPoolExecutor
from... |
IncomingMessageService.py | from Logics.BluetoothManager import BluetoothManager
from data import ServerEnvelope, PebbleCommand
from services.IncomingPebbleMessageService import IncomingPebbleMessageService
from injector import inject, singleton
import threading
class IncomingMessageService(object):
@singleton
@inject(bluetoothManager =... |
__init__.py | from __future__ import division
import os
import json
import socket
import logging
import operator
import threading
from datetime import datetime, timedelta
from time import sleep
from functools import total_ordering, wraps, partial
import amqp
from flask import Flask, Blueprint
from flask import render_template, redi... |
crawler.py | #!/usr/bin/env python
#
# This script is experimental.
#
# Liang Wang @ Dept. Computer Science, University of Helsinki
# 2011.09.20
#
import os, sys
import socket
import pickle
import Queue
import random
import time
import threading
import resource
from khash import *
from bencode import bencode, bdecode
from common... |
__init__.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... |
cli.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import click
import copy
from functools import wraps
import glob
import io
import json
import logging
import netrc
import os
import random
import re
import requests
import shlex
import signal
import socket
import stat
import subprocess
import sys
import tex... |
sql.py | # Date: 01/27/2021
# Author: Borneo Cyber
# Description: SQL checker
from .log import Log
from .search import Search
from .browser import Browser
from time import sleep, time
from .display import Display
from threading import Thread, RLock
from .const import max_time_to_wait, max_active_browsers
class SQL(object):
... |
interactive.py | """
Special module for defining an interactive tracker that uses napari to display fields
.. codeauthor:: David Zwicker <david.zwicker@ds.mpg.de>
"""
import logging
import multiprocessing as mp
import platform
import queue
import signal
import time
from typing import Any, Dict, Optional
from ..fields.base import Fie... |
test.py | import argparse
import json
import os
from pathlib import Path
from threading import Thread
import numpy as np
import torch
import yaml
from tqdm import tqdm
from models.experimental import attempt_load
from utils.datasets import create_dataloader
from utils.general import coco80_to_coco91_class, check_dataset, check... |
queue.py | import json
import logging
import os
import threading
import time
# import gevent
import redis as Redis
from gevent import monkey
from rx import Observable
monkey.patch_all()
logger = logging.getLogger(__name__)
REDIS_URL = os.environ.get('REDIS_URL') or 'redis://localhost:6379'
REDIS_CHAN_MESSAGES = 'messages' #... |
t4.py | import time
from threading import Thread
def sleepMe(i):
print("Thread %i gonna to sleep for 8 seconds." % i)
time.sleep(8)
print("Thread %i woke up." % i)
for i in range(10):
th = Thread(target=sleepMe, args=(i, ))
th.start()
|
schedule.py | import time
from multiprocessing import Process
import asyncio
import aiohttp
try:
from aiohttp.errors import ProxyConnectionError,ServerDisconnectedError,ClientResponseError,ClientConnectorError
except:
from aiohttp import ClientProxyConnectionError as ProxyConnectionError,ServerDisconnectedError,ClientRespons... |
test_util.py | # MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY ... |
get_images_and_info.py | import os
import time
import pickle
import shutil
import requests
from requests_html import HTMLSession
from threading import Lock, Thread
from tqdm import tqdm
vase_fname = 'data/raw/vase_links_all.txt'
info_fname = 'data/raw/vase_info.pkl'
n_vases = 25610 # may change if file above is regenerated
def requests_se... |
util.py | # Electrum - lightweight Bitcoin client
# Copyright (C) 2011 Thomas Voegtlin
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights t... |
env_stock_papertrading_sb3.py | import datetime
import threading
import time
import alpaca_trade_api as tradeapi
import numpy as np
import pandas as pd
from finrl_meta.data_processors.alpaca import Alpaca
class AlpacaPaperTrading_sb3():
def __init__(self, ticker_list, time_interval, agent, cwd, net_dim,
state_d... |
cv2capture.py | ###############################################################################
# OpenCV video capture
# Uses opencv video capture to capture system's camera
# Adapts to operating system and allows configuation of codec
# Urs Utzinger
# 2021 Initialize, Remove Frame acces (use only queue)
# 2019 Initial release, based ... |
replay_buffer.py | try:
import queue
except:
import Queue as queue
from random import shuffle
from random import seed
seed(123)
from threading import Thread
import numpy as np
import time
import tensorflow as tf
try:
import Queue as Q # ver. < 3.0
except ImportError:
import queue as Q
from sklearn.preprocessing import normalize
... |
queues.py | import copy
import multiprocessing
import re
import requests
import setproctitle
import time
from shakenfist.config import config
from shakenfist.daemons import daemon
from shakenfist import db
from shakenfist import exceptions
from shakenfist.images import Image
from shakenfist import logutil
from shakenfist import n... |
terminate_the_fuck_gpu.py | #A stratum compatible miniminer
#based in the documentation
#https://slushpool.com/help/#!/manual/stratum-protocol
#2017-2019 Martin Nadal https://martinnadal.eu
import socket
import json
import random
import traceback
import tdc_mine
import time
from multiprocessing import Process, Queue, cpu_count
from numba import... |
database.py | """A utility class that handles database operations related to covidcast.
See src/ddl/covidcast.sql for an explanation of each field.
"""
# third party
import json
import mysql.connector
import numpy as np
from math import ceil
from queue import Queue, Empty
import threading
from multiprocessing import cpu_count
# ... |
prepare_bible.py | #!/usr/bin/env python3
from subprocess import run
from threading import Thread
import os
import shutil
import sys
import osis_tran
SCRIPTS = 'mosesdecoder/scripts'
TOKENIZER = SCRIPTS + '/tokenizer/tokenizer.perl'
CLEAN = SCRIPTS + '/training/clean-corpus-n.perl'
BPEROOT = 'subword-nmt'
BPE_TOKENS = 30000
CLEAN_RAT... |
Wallet.py | #!/usr/bin/env python3
##########################################
# Duino-Coin Tkinter GUI Wallet (v2.4)
# https://github.com/revoxhere/duino-coin
# Distributed under MIT license
# © Duino-Coin Community 2019-2021
##########################################
import sys
from base64 import b64decode, b64encode
fro... |
backdoor.py | import socket
import json
import subprocess
import time
import os
import pyautogui
import keylogger
import threading
import shutil
import sys
def reliable_send(data):
jsondata = json.dumps(data)
s.send(jsondata.encode())
def reliable_recv():
data = ''
while True:
try:
data = data +... |
Runner.py | # Copyright (c) 2017 Iotic Labs Ltd. 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
#
# https://github.com/Iotic-Labs/py-IoticBulkData/blob/master/LICENSE
#
# Unless... |
ingestion_listener.py | import argparse
import atexit
import boto3
import botocore.exceptions
import cgi
import datetime
import elasticsearch
import io
import json
import os
import psycopg2
import re
import requests # XXX: C4-211 should not be needed but is // KMP needs this, too, until subrequest posts work
import signal
import structlog
im... |
atomos_demo.py | # coding: utf-8
import sys
import os
sys.path.append(os.getcwd())
from Morphe.Atomos import Atomos
from Morphe.Morphe import Morphe
import asyncio
import time
import threading
import queue
import functools
def get_from_atomos(q):
count = 0
while True:
count += 1
data = q.get()
print("{... |
greengrassHelloWorld.py | print("Started Lambda")
import awscam
import mo
import cv2
from datetime import datetime
import json
from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket
import sys
from threading import Thread
from base64 import b64encode
clients = []
class ResultsServer(WebSocket):
def handleConnected(self):
... |
iot-hub-client-message.py | import json
import random
import re
import sys
import threading
import time
from azure.iot.device import IoTHubDeviceClient, Message
AUX_CONNECTION_STRING = sys.argv[1]
AUX_BASE_HEART_RATE = 65
AUX_BASE_BODY_TEMPERATURE = 37.0
AUX_MAXIMUM_BODY_TEMPERATURE = 40.0
#SENSOR DATA WILL HOST SENSOR METRICS
... |
base_crash_reporter.py | # Electrum - lightweight Bitcoin client
#
# 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, merge,
# publish... |
parallel_environments.py | import multiprocessing
import gym
import torch
from multiprocessing import Process, Pipe
from actor_critic.environment_wrapper import EnvironmentWrapper
def worker(connection, stack_size):
env = make_environment(stack_size)
while True:
command, data = connection.recv()
if command == 'step':
... |
apply-firewall.py | #!/usr/bin/env python
"""
Apply a "Security Group" to the members of an etcd cluster.
Usage: apply-firewall.py
"""
import os
import re
import string
import argparse
from threading import Thread
import uuid
import colorama
from colorama import Fore, Style
import paramiko
import requests
import sys
import yaml
def ge... |
AVR_Miner.py | #!/usr/bin/env python3
##########################################
# Duino-Coin AVR Miner (v2.2)
# https://github.com/revoxhere/duino-coin
# Distributed under MIT license
# © Duino-Coin Community 2021
##########################################
import socket, threading, time, re, subprocess, configparser, sys, datetime, ... |
trainer_utils.py | # coding=utf-8
# Copyright 2020-present the HuggingFace Inc. team.
#
# 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 ap... |
elsevier_process_outlines.py | import requests
import requests_random_user_agent
import threading
from pymongo import errors, MongoClient
import config
import json
from progress.bar import Bar
threads_amount = 5
threads = list()
def get_title(text):
if '_' in text.keys():
return(text['_'])
else:
aux = ''
for part in... |
socketserverhandler.py | import socket as pythonsocket
from threading import Thread
from time import sleep
import datetime
import pickle
import datetime
import database
import string
import random
import settings
socket = pythonsocket.socket(pythonsocket.AF_INET, pythonsocket.SOCK_STREAM)
def startServer():
database.begin... |
test.py | # python3
SERVER_SOCKET_PATH = _s = 'socket'
import socket, sys, os, threading, struct
def pe(s):
print(s, file=sys.stderr)
def th(b):
# network is big endian
return int.from_bytes(b, 'big', signed=False)
def trans(b):
msg = b''
for x in b:
msg += struct.pack('!I', x)
return msg
l = threading.Lock()
t = {... |
robot.py | #!/usr/bin/env python3
# encoding: utf-8
#
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
#
# This file is part of ewm-cloud-robotics
# (see https://github.com/SAP/ewm-cloud-robotics).
#
# This file is licensed under the Apache Software License, v. 2 except as noted
# otherwise in the LIC... |
KatyOBD.py | import obd
import tkinter as tk
import time
import threading
### OBD Connection
connection = obd.OBD()
### Helper Functions
str_rpm = '0'
str_speed = '0'
str_coolant_temp = '0'
str_fuel_level = '0'
str_intake_temp = '0'
str_throttle_pos = '0'
str_intake_pressure = '0'
indicator = 0
def parseAuto():
global str... |
client.py | import json
import logging
import socket
import threading
import os
import sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir)
from validator import port_validation, ip_validation
DEFAULT_PORT = 9090
DEFAULT_IP = "127.0.0.1"
END_MESSAGE_FLAG ... |
client_sent_recv.py | import socket
import sys
import threading
serverName = 'localhost'
serverPort = 21128
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientSocket.connect((serverName, serverPort))
print('连接服务器成功')
def runn():
while True:
sentence = input('')
clientSocket.send(sentence.encode("ut... |
controller.py | import time
import multiprocessing as mp
import numpy as np
import flappy
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Bernoulli
import matplotlib.pyplot as plt
class Net(nn.Module):
# Define network parameters
def __init__(self... |
pool.py | import heapq
import os
import threading
import time
from peewee import *
from peewee import _savepoint
from peewee import _transaction
from playhouse.pool import *
from .base import BaseTestCase
from .base import ModelTestCase
from .base_models import Register
class FakeTransaction(_transaction):
def _add_histo... |
test_chunkstore_s3.py | ################################################################################
# Copyright (c) 2017-2019, National Research Foundation (Square Kilometre Array)
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy
# of the... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The MTcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import ... |
core.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from pympler import tracker
import configparser
from datetime import datetime
from core.gtfobins_scraper import get_gtfobin
import time
from core.redis_client import RedisClient
from database.models import RegressionTests, Runs
from core.ssh_session import Session
import ... |
test_client.py | # Copyright 2013-2015 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 writin... |
mailpillager.py | #!/usr/bin/env python3
import os
import imaplib
import poplib
import email.parser
import re
import ssl
from threading import Thread
#-----------------------------------------------------------------------------
# Primary Pillager Class that all others are sub classes of
# This really does nothing and is just a place ... |
PyShell.py | #! /usr/bin/env python
import os
import os.path
import sys
import string
import getopt
import re
import socket
import time
import threading
import traceback
import types
import linecache
from code import InteractiveInterpreter
try:
from Tkinter import *
except ImportError:
print>>sys.__stderr__, "** IDLE can... |
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... |
main.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import face_recognition
import cv2
import numpy as np
import pymongo
import sys
import time
import logging as log
from imutils.video import WebcamVideoStream
from openvino.inference_engine import IENetwork, IEPlugin
from sklearn.metri... |
data.py | import sys
if sys.version_info[0] == 2:
import Queue as queue
else:
import queue
import os
import math
import multiprocessing as mp
import threading
import torch
from torch.utils.data import Dataset
import numpy as np
from utils import get_receptive_field, get_sub_patch_shape, \
get_offset, sample_coor... |
letter_counter.py | import json
import urllib.request
import time
from threading import Thread, Lock
finished_count = 0
def count_letters(url, frequency, mutex):
response = urllib.request.urlopen(url)
txt = str(response.read())
mutex.acquire()
for l in txt:
letter = l.lower()
if letter in frequency:
... |
markovtweets.py | from time import sleep
from datetime import datetime
import calendar
import threading
import random
import logging
import os
from . import markov_chain
from . import string_control
class MarkovTweets:
def __init__(self, api, settings):
self.api = api
self.settings = settings
self.chain = ... |
DynamicMedia.py | #!/usr/bin/python3
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GObject, GdkPixbuf, Gdk
import tempfile
import cgi,posixpath
import time
import urllib.request,urllib.parse
import os
from shutil import copyfile
from threading import Thread
try:
import math
inf=math.inf
except:
inf=float... |
debugger.py | import asyncio
import signal
import sys
import threading
from IPython.core.debugger import Pdb
from IPython.core.completer import IPCompleter
from .ptutils import IPythonPTCompleter
from .shortcuts import create_ipython_shortcuts, suspend_to_bg, cursor_in_leading_ws
from prompt_toolkit.enums import DEFAULT_BUFFER
fr... |
bot.py | """
[emoji symbols]
orange box : 🔸
man with laptop : 👨💻
"""
import os
import telebot
from telebot import types
import random
import json
import threading ,schedule,time #extras
from utils.github_tools import *
TOKEN = open('test-key.txt').readline()
# TOKEN = os.getenv('TG_TOKEN')
cpp_data = json.load(open('ut... |
bench-graphsize-th.py | #! /usr/bin/env python2
#
# This file is part of khmer, http://github.com/ged-lab/khmer/, and is
# Copyright (C) Michigan State University, 2009-2013. It is licensed under
# the three-clause BSD license; see doc/LICENSE.txt.
# Contact: khmer-project@idyll.org
#
import khmer
import sys
import screed
import threading
imp... |
roll_pair.py | # -*- coding: utf-8 -*-
# Copyright (c) 2019 - now, Eggroll 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... |
darkrise_backdoor.py | #!/usr/bin/python2
#-*- coding:utf-8 -*-
#Author : Unamed - Backdoor
#Client File
import os
import socket
import subprocess
import requests
import json
import sys
import platform
import shutil
import shlex
from ftplib import FTP
from ftplib import FTP_TLS
import cv2
import time
from datetime import datetime
import web... |
mills_old.py | #!/usr/bin/env python
import numpy as np
import ai
import pygame
from time import sleep
from threading import Thread
from threading import Event
# SETTINGS
GUI = True
BACKGROUND = (90, 90, 90) # gray
PLAYER1 = (240, 240, 240) # almost white
PLAYER2 = (10, 10, 10) # almost black
TEXT = (50, 50, 240)
pygame.font.init()
... |
practice.py | import sys, os, imp, time
import RPi.GPIO as GPIO
import threading
GPIO.setmode(GPIO.BCM)
# # TODO a function that returns the detected particle concentration
# based on measurement data and mathematic model, possibly requires import of .mdl
# Currently a dummy function.
def get_detected_level():
led.emitter(True... |
serial_io.py | from __future__ import division
import json
import time
import serial as _serial
import platform
import sys
if sys.version_info >= (3, 0):
import queue
else:
import Queue as queue
from threading import Event, Thread
from serial.tools.list_ports import comports
from . import IOHandler
try:
JSONDecodeEr... |
sqlite3_isolation_levels.py | #!/usr/bin/env python3
# encoding: utf-8
#
# Copyright (c) 2010 Doug Hellmann. All rights reserved.
#
"""Illustrate the effect of isolation levels.
"""
#end_pymotw_header
import logging
import sqlite3
import sys
import threading
import time
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s (%(thr... |
server.py | #-----------------------------------------------------------
# Threaded, Gevent and Prefork Servers
#-----------------------------------------------------------
import datetime
import errno
import logging
import os
import os.path
import platform
import random
import select
import signal
import socket
import subprocess
... |
project_run.py | #!/usr/bin/python
# ----------------------------------------------------------------------------
# cocos "install" plugin
#
# Authr: Luis Parravicini
#
# License: MIT
# ----------------------------------------------------------------------------
'''
"run" plugin for cocos command line tool
'''
__docformat__ = 'restruc... |
hpclient.py | # Run this script to launch a client and try to connect to a remote
# server defined in the clientconf.toml config file.
from threading import Thread
import hpclient_vulkan as hpclient
# import hpclient_dx12 as hpclient
# import hpclient_gl as hpclient
# Instantiate a new Client.
c = hpclient.Client("clientconf.toml"... |
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... |
tf_util.py | import numpy as np
import tensorflow as tf # pylint: ignore-module
import copy
import os
import functools
import collections
import multiprocessing
def switch(condition, then_expression, else_expression):
"""Switches between two operations depending on a scalar value (int or bool).
Note that both `then_expres... |
daqmx.py | from collections import namedtuple
from fixate.core.common import ExcThread
# Basic Functions
from PyDAQmx import byref, DAQmxResetDevice, TaskHandle, numpy, int32, uInt8, float64, uInt64, c_char_p, uInt32
# Tasks
from PyDAQmx import DAQmxCreateTask, DAQmxStartTask, DAQmxWaitUntilTaskDone, DAQmxStopTask, DAQmxClearTask... |
frontend.py | #!/usr/bin/env python3
# *************************************************************************
#
# Copyright (c) 2021 Andrei Gramakov. All rights reserved.
#
# This file is licensed under the terms of the MIT license.
# For a copy, see: https://opensource.org/licenses/MIT
#
# site: https://agramakov.me
# e-mai... |
test_local_server.py | import threading
import requests
import pytest
from six.moves.urllib.parse import urlencode
from fair_research_login.local_server import LocalServerCodeHandler
from fair_research_login.exc import LocalServerError
class LocalServerTester:
def __init__(self, handler):
self.handler = handler
self.s... |
test_subprocess.py | import unittest
from unittest import mock
from test import support
import subprocess
import sys
import signal
import io
import os
import errno
import tempfile
import time
import selectors
import sysconfig
import select
import shutil
import gc
import textwrap
try:
import threading
except ImportError:
threading ... |
wallet.py | # Electrum - lightweight Bitcoin client
# Copyright (C) 2015 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... |
websockets.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 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... |
thread_join.py | import threading
import time
"""
测试一下 python 多线程中 join 的功能:
测试结果显示,线程 A 加入 join 后,主线程会等待线程 A 执行完毕后再推出
如果不加 join,主线程不等线程 A 执行完就退出,也就是说,
join 的作用就是线程同步
"""
def run():
time.sleep(2)
print('当前线程的名字是: ', threading.current_thread().name)
time.sleep(2)
if __name__ == '__main__':
start_time = time... |
ros_yolact_rl_grap_main.py | #!/usr/bin/env python
import time
import os
import random
import threading
import argparse
import matplotlib.pyplot as plt
import numpy as np
import scipy as sc
import cv2
from collections import namedtuple
import torch
from torch.autograd import Variable
from ros_yolact_rl_grap_robot import Robot
from trainer impor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.