source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
main.py | #! /usr/bin/python
import random
import threading
import queue
import os
import time
import re
import json
from mastodon import Mastodon, CallbackStreamListener, MastodonAPIError, MastodonRatelimitError
import sys
sys.path.insert(0, './ace-attorney-reddit-bot')
import anim
from collections import Counter
from datetime ... |
dqn_test_2.py | """
Copyright (c) College of Mechatronics and Control Engineering, Shenzhen University.
All rights reserved.
Description :
dqn algorithm used for controling the steer to make a vehicle keep lane.
Author:Team Li
"""
import tensorflow as tf
import cv2, math, sys, random, threading
from efficient_driving.basic_net.dqn_... |
pi_object_detection.py | # import the necessary packages
from multiprocessing import Process
from multiprocessing import Queue
import os
import threading
import argparse
import time
import logging
import cv2
import json
import db
from classifier import Detection
from flask import Flask, render_template, Response, request, redirect, jsonify,... |
ntlmrelayx.py | #!/usr/bin/env python
# Impacket - Collection of Python classes for working with network protocols.
#
# SECUREAUTH LABS. Copyright (C) 2022 SecureAuth Corporation. All rights reserved.
#
# This software is provided under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# f... |
scripted.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import time
import logging
from rapidsms.router import router as globalrouter
import unittest, re, threading
from django.test import TransactionTestCase
from django.conf import settings
from datetime import datetime
from rapidsms.log.mixin import LoggerMixin
class T... |
datasets.py | from flask import request
from flask_restplus import Namespace, Resource, reqparse
from flask_login import login_required, current_user
from werkzeug.datastructures import FileStorage
from mongoengine.errors import NotUniqueError
from mongoengine.queryset.visitor import Q
from threading import Thread
from google_image... |
dataengine-service_install_libs.py | #!/usr/bin/python
# *****************************************************************************
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The A... |
forwarder.py | import pyaudio
import socket
import time
from threading import Thread
frames = []
client_ip = '10.0.0.3'
server_ip = '10.0.0.4'
port = 12345
def udpStream(CHUNK):
udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
udp.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
udp.bind((client_ip, port))
... |
gui.py | import core
from core import Tk, Button, Frame, Label, DISABLED, ACTIVE, PhotoImage, LEFT, messagebox, capes, threading, time, job
from conf import users
u_count = 0
t = None
root = Tk()
photo = PhotoImage(file=r"res/pause.png")
photoimage = photo.subsample(10, 10)
photo_start = PhotoImage(file=r"res/start.png")
phot... |
aff4_test.py | #!/usr/bin/env python
# -*- mode: python; encoding: utf-8 -*-
"""Tests for the flow."""
import itertools
import os
import threading
import time
import mock
# pylint: disable=unused-import,g-bad-import-order
# Import this so that filters classes are initialized (used in Query tests).
# TODO(user): deprecate Query su... |
ssh.py | #!/usr/bin/python
import getopt
import sys
from threading import Thread
from datetime import datetime
import uuid
sys.path = [".", "lib"] + sys.path
from platform_utils.remote.remote_util import RemoteMachineShellConnection
import TestInput
import logging.config
logging.config.fileConfig("scripts.logging.conf")
log ... |
deltaproxy.py | #
# Proxy minion metaproxy modules
#
import copy
import logging
import os
import sys
import threading
import traceback
import types
import salt
import salt.beacons
import salt.cli.daemons
import salt.client
import salt.config
import salt.crypt
import salt.defaults.exitcodes
import salt.engines
import salt.loader
im... |
main.py | import logging
import logging.config
import threading
import time
import os
from datetime import datetime
from time import gmtime, strftime
from server import ServerService
from rpyc.utils.server import ThreadedServer
from logs.setup import setup_logging
from config.server import WHO_AM_I, ROUND_TIME, TIME_FORMAT, K... |
camera.py | import configparser
import logging
import math
import os
import pathlib
import threading
import time
import glob
from contextlib import contextmanager
from functools import wraps
from io import BytesIO
from pathlib import Path
from queue import Queue
from typing import List
import cv2
from PIL import Image, _webp
from... |
jobworker.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import pickle
import threading
import ray
import ray.streaming._streaming as _streaming
from ray.streaming.config import Config
from ray.function_manager import FunctionDescriptor
from ray.strea... |
redis.py | from dataclasses import dataclass
import threading
import time
from typing import Any, Dict, Optional
import uuid
from tetra.tools.__config__ import TETRA_UNIT_TESTING
if TETRA_UNIT_TESTING:
import fakeredis as redis # type: ignore
else:
import redis # type: ignore
@dataclass
class BrokerTaskMetricsItem:
... |
test.py | import threading
from tinydb import TinyDB, where
from tinyrecord import transaction
db = TinyDB('db.json')
db.purge()
table = db.table('settings')
table.insert({'name': 'test', 'value': 0})
def increment_values():
for i in range(100):
with transaction(table) as tr:
def f(doc):
... |
test_ext_kerberos.py | #!/usr/bin/env python
# encoding: utf-8
"""Test Kerberos extension."""
from nose.tools import eq_, nottest, ok_, raises
from threading import Lock, Thread
from time import sleep, time
import sys
class MockHTTPKerberosAuth(object):
def __init__(self, *args):
self._lock = Lock()
self._calls = set()
sel... |
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... |
trackhandemoji.py | # -*- coding: utf-8 -*-
import cv2
import numpy as np
import os
import time
import threading
import gestureCNN as myNN
minValue = 70
x0 = 400
y0 = 200
height = 200
width = 200
saveImg = False
guessGesture = False
visualize = False
kernel = np.ones((15,15),np.uint8)
kernel2 = np.ones((1,1),np.uint8)
skinkernel = ... |
command.py | # Copyright (c) 2016-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import argparse
import enum
import logging
import os
import re
import resource
import signal
import subprocess
import threading
from ... |
task_queue.py | # -*- coding: utf-8 -*-
import threading
import sys
import logging
logger = logging.getLogger(__name__)
try:
import Queue as queue
except ImportError:
import queue
import traceback
class TaskQueue(object):
def __init__(self, producer, consumers):
self.__producer = producer
self.__consu... |
lambda_executors.py | import os
import re
import sys
import glob
import json
import time
import logging
import threading
import subprocess
import six
import base64
from multiprocessing import Process, Queue
try:
from shlex import quote as cmd_quote
except ImportError:
from pipes import quote as cmd_quote # for Python 2.7
from local... |
bot.py | import re
import time
import queue
import logging
import threading
import collections
import json as json_
import websocket
WS_URL = "ws://127.0.0.1:6700/ws" # WebSocket 地址
NICKNAME = ["BOT", "ROBOT"] # 机器人昵称
SUPER_USER = [12345678, 23456789] # 主人的 QQ 号
# 日志设置 level=logging.DEBUG -> 日志级别为 DEBUG
logging.b... |
stream.py | # Copyright (c) 2015, Narrative Science
# 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 conditions and... |
helpers.py | """
:copyright: Copyright 2013-2017 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
tests.support.helpers
~~~~~~~~~~~~~~~~~~~~~
Test support helpers
"""
import base64
import builtins
import errno
import fnmatch
import functools
import inspe... |
popen_spawn.py | """Provides an interface like pexpect.spawn interface using subprocess.Popen
"""
import os
import threading
import subprocess
import sys
import time
import signal
import shlex
try:
from queue import Queue, Empty # Python 3
except ImportError:
from Queue import Queue, Empty # Python 2
from .spawnbase import ... |
ConnectionMonitor.py | from abc import ABC, abstractmethod
import logging
import threading
from events import Events
logger = logging.getLogger(__name__)
class ConnectionMonitor(ABC):
"""Monitor hardware for connection to device.
Arguments:
name : str
user-visible name of the hardware type being monitored
... |
pygments_style.py | """Add an action for choosing the Pygments style."""
import threading
import pygments.styles
from porcupine import actions, get_main_window, settings
# TODO: here's old code that created colored menu items, add it back
# style = pygments.styles.get_style_by_name(name)
# bg = style.background_color
#
#... |
main.py | import threading
from queue import Queue
from spider import Spider
from domain import *
from general import *
#PROJECT_NAME = 'ug'
#HOMEPAGE = 'https://ugroupcu.com/'
PROJECT_NAME = 'MHM_links'
HOMEPAGE = 'https://www.mhmproperties.com/'
DOMAIN_NAME = get_domain_name(HOMEPAGE)
QUEUE_FILE = PROJECT_NAME + '/queue.txt'
... |
generals.py |
import logging
import json
import threading
import time
from websocket import create_connection, WebSocketConnectionClosedException
EMPTY = -1
MOUNTAIN = -2
FOG = -3
OBSTACLE = -4
BOT = 1
ENEMY = 0
_ENDPOINTS = {
'na': "ws://ws.generals.io/socket.io/?EIO=3&transport=websocket",
'eu': "ws://euws.generals.io... |
debugme.py | import multiprocessing
import os
import time
from multiprocessing import freeze_support
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
from datetime import datetime, timedelta
import runpy
def run_py():
runpy.run_path(path_name='main.py')
def rerun_script():
gl... |
ig_parser.py | # -*- coding: utf-8 -*-
#####################################################################################################################
# #
# Парсер количества подписчиков и среднего количества просмо... |
PI_xcopilot.py | from XPLMDataAccess import *
from XPLMUtilities import *
from XPLMPlugin import *
from XPLMDefs import *
from XPLMProcessing import *
from xcopilot import XCopilot
from xcopilot.xplane import StatusWidget
import threading
import os
import logging
XPLM_MSG_PLANE_LOADED = 102
SetDataRef = {
'float': XPLM... |
cwmp2.py | #running speed : 300-350 pair/menit per proses. 3000-3500 pair/menit utk seluruh proses.
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 22 16:17:11 2016
@author: ilham
"""
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 13 08:52:35 2016
@author: ilham
"""
import mysql.connector
import sys
from multiprocessing impor... |
data_util.py | '''
this file is modified from keras implemention of data process multi-threading,
see https://github.com/keras-team/keras/blob/master/keras/utils/data_utils.py
'''
import time
import numpy as np
import threading
import multiprocessing
try:
import queue
except ImportError:
import Queue as queue
class Generato... |
chk_con_nbu.py | import logging
import os.path
import platform
import socket
import subprocess
import threading
from threading import Timer
from math import ceil
from optparse import OptionParser
from sys import exit, stdout
if platform.system() == 'Windows':
is_win = True
else:
is_win = False
if is_win:
bin_admin_path = ... |
collect_data.py | import static
import glob
import pandas as pd
import os
import shutil
import time
from multiprocessing import Process, Manager, Lock, Pool
import logging
# create logger with 'spam_application'
logger = logging.getLogger('spam_application')
logger.setLevel(logging.DEBUG)
# create file handler which logs even debug mes... |
test_distributed.py | from __future__ import absolute_import, division, print_function, unicode_literals
import copy
import fcntl
import multiprocessing
import os
import sys
import time
import tempfile
import unittest
from contextlib import contextmanager
from datetime import timedelta
from functools import reduce, wraps
import torch
impor... |
single_process.py | from ..args_provider import ArgsProvider
import sys
import tqdm
class SingleProcessRun:
def __init__(self):
''' Initialization for SingleProcessRun. Accepted arguments:
``num_minibatch``,
``num_episode``,
``tqdm``
'''
self.args = ArgsProvider(
call_from... |
process.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import tempfile
import subprocess
import tensorflow as tf
import numpy as np
import tfimage as im
import threading
import time
import multiprocessing
edge_pool = None
parser = argp... |
main.py | import os
import sys
import time
import pdb
import argparse
import logging
import traceback
from multiprocessing import Process
from queue import Queue
from logging import handlers
from yaml import full_load, dump
from local_runner import LocalRunner
from docker_runner import DockerRunner
from k8s_runner import K8sRunn... |
server_lifecycle.py | from threading import Thread
import audio
def on_server_loaded(server_context):
t = Thread(target=audio.update_audio_data, args=())
t.setDaemon(True)
t.start()
|
gog_gui.py | """
Module specifying classes and methods to create and interact with the GUI
interface for gog-tux.
It holds the GUI mainwindow class, the Login window class and the window used
to output external commands and scripts.
"""
import os
import pygtk
pygtk.require("2.0")
import gtk
import gobject
import gtk.glade
import ... |
lan_sc2_env.py | # Copyright 2017 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 ... |
publisher.py | import errno
import hashlib
import os
import posixpath
import select
import shutil
import subprocess
import tempfile
import threading
from contextlib import contextmanager
from werkzeug import urls
from lektor._compat import (iteritems, iterkeys, range_type, string_types,
text_type, queue, StringIO)
from lektor.e... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import asyncio
from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence
from electrum_ltc.storage import WalletStorage, StorageReadWriteError
from electrum_ltc.wallet_db import WalletDB... |
threads.py | import sys
import time
if sys.version_info < (3, 0):
from Queue import Queue
else:
from queue import Queue
import threading, requests
from jotting import book, to, read
logbox = "~/Desktop/logbox.txt"
book.distribute(to.File(path=logbox))
def get(queue, url, parent):
"""Get the URL and queue the response... |
lambda_executors.py | import os
import re
import glob
import json
import time
import logging
import threading
import subprocess
import six
from multiprocessing import Process, Queue
try:
from shlex import quote as cmd_quote
except ImportError:
from pipes import quote as cmd_quote # for Python 2.7
from localstack import config
from ... |
Mario.py | # -*- coding: utf-8 -*-
import os, sys, time, datetime, random, hashlib, re, threading, json, getpass, urllib, requests, mechanize
from multiprocessing.pool import ThreadPool
try:
import mechanize
except ImportError:
os.system('pip2 install mechanize')
else:
try:
import requests
except ImportEr... |
stim_server_client.py | # Author: Mainak Jas <mainak@neuro.hut.fi>
# License: BSD (3-clause)
import queue
import time
import socket
import socketserver
import threading
import numpy as np
from ..utils import logger, verbose
class _ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
"""Create a threaded TCP server.... |
mainwindow.py | """The Qt MainWindow for the QtConsole
This is a tabbed pseudo-terminal of Jupyter sessions, with a menu bar for
common actions.
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import sys
import webbrowser
from threading import Thread
from jupyter_core.paths i... |
main.py | import web,time,Adafruit_ADS1x15,tempvar
from web import form
import RPi.GPIO as GPIO
from threading import Thread
global infrared, ultrasonic, servomotor, motor_L1, motor_L2, motor_R1, motor_R2, servo_turning_time, outputpin, carspeed, gpiodidstartup
ultrasonic = 8
infrared = 11
servomotor = 12
motor_L1 = 19
... |
startServer.py | #!/usr/bin/env python
import argserver
from front import Screen
import requesthandler
import signal
import threading
if __name__ == '__main__':
# ncurses-window
screen = Screen()
HOST, PORT = 'localhost', 9000
argserver.HTTPServer.allow_reuse_address = True
server = argserver.HTTPServer((HOST, PO... |
lbph_face_detector.py | import cv2 as cv
import util
import threading
import detect_it_all_bot
import time
from faces_util import align_face
class LBPHFacedDetector():
def __init__(self,
classifier_path: str,
eye_classifier_path: str,
recognizer_path: str,
names,
... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import electrum
from electrum.bitcoin import TYPE_ADDRESS
from electrum import WalletStorage, Wallet
from electrum_gui.kivy.i18n import _
from electrum.paymentrequest import InvoiceStore
from electr... |
core.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""PY4WEB - a web framework for rapid development of efficient database driven web applications"""
# Standard modules
import asyncio
import cgitb
import code
import copy
import datetime
import enum
import functools
import http.client
import http.cookies
import importlib.ma... |
gatecoin.py | from befh.restful_api_socket import RESTfulApiSocket
from befh.exchanges.gateway import ExchangeGateway
from befh.market_data import L2Depth, Trade
from befh.util import Logger
from befh.instrument import Instrument
from befh.clients.sql_template import SqlClientTemplate
import time
import threading
from functools impo... |
chatGUI.py |
from tkinter import *
from tkinter import ttk
################NETWORK##################
import socket
import threading
server_ip = '192.168.1.150'
port = 8000
# -*- coding: utf-8 -*-
def Server():
while True:
server = socket.socket()
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,1)
ser... |
test_decorator.py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import subprocess
import sys
import threading
import unittest
from concurrent.futures import ThreadPoolExecutor, as_completed
from maro.communication import Proxy, SessionMessage, dist
from tests.communication.utils import get_random_p... |
server.py | import numpy as np
import os
import io
# import for server
from flask import Flask, render_template, request, Response, send_file, jsonify
from queue import Queue, Empty
import threading
import time
# import for model
from transformers import AutoTokenizer, AutoModelWithLMHead, top_k_top_p_filtering
from torch.nn imp... |
train.py | import gfootball.env as football_env
import time, pprint, json, os, importlib, shutil
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Categorical
import torch.multiprocessing as mp
from tensorboardX import SummaryWriter
f... |
repl.py | """
Utility for creating a Python repl.
::
from ptpython.repl import embed
embed(globals(), locals(), vi_mode=False)
"""
import asyncio
import builtins
import os
import sys
import threading
import traceback
import types
import warnings
from dis import COMPILER_FLAG_NAMES
from enum import Enum
from typing imp... |
test_tls.py | import socket
import ssl
from contextlib import ExitStack
from threading import Thread
from typing import NoReturn
import pytest
from trustme import CA
from anyio import (
BrokenResourceError, EndOfStream, Event, connect_tcp, create_task_group, create_tcp_listener)
from anyio.abc import AnyByteStream, SocketAttri... |
test_threaded_restapi.py | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
preprocess_centauro_imagenet.py | # coding=utf8
import argparse, os, json, string
from collections import Counter
from Queue import Queue
from threading import Thread, Lock
from math import floor
import h5py
import numpy as np
import sys
import xmltodict
import os
from scipy.misc import imread, imresize
OBJECTS = [
("", "[background]"),
("n0323972... |
core.py | """
.. module:: session
:synopsis: Main module for scilab2py package.
Contains the Scilab session object Scilab2Py
.. moduleauthor:: Steven Silvester <steven.silvester@ieee.org>
"""
from __future__ import print_function
import os
import re
import atexit
import glob
import logging
import... |
widget.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
The widget is called from web2py.
"""
import datetime
import sys
import cStringIO
import time
import threa... |
watchdog.py | __author__ = 'Dmitry Golubkov'
import threading
import time
class Watchdog(object):
def __init__(self, logger, client_list, timeout=1):
self.logger = logger
self.client_list = client_list
self.timeout = timeout
self.thread = threading.Thread(target=self.worker, args=())
se... |
process.py | # Copyright 2020 Uber Technologies, 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 ... |
coronet_gps_sync_updated.py | import argparse
import pickle as pickle
import socket
from ctypes import c_char_p
from multiprocessing import Process, Queue, Manager
import torch
import torch.nn as nn
import torchvision
import util_gps
# import util_tf_v2_migrated
import torch_util
TCP_IP = '0.0.0.0'
global_var_vals = None
done_flag = None
ack_q =... |
cli.py | # encoding: utf-8
from __future__ import print_function
import collections
import csv
import multiprocessing as mp
import os
import datetime
import sys
from pprint import pprint
import re
import itertools
import json
import logging
from optparse import OptionConflictError
import traceback
from six import text_type
f... |
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... |
callback.py | from utlis.rank import setrank,isrank,remrank,remsudos,setsudo,GPranks,IDrank
from utlis.send import send_msg, BYusers, Sendto, fwdto,Name,Glang,getAge
from utlis.locks import st,getOR,Clang,st_res
from utlis.tg import Bot
from config import *
from pyrogram import ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeybo... |
test_counter.py | import multiprocessing
import BTrees.Length
import pytest
import sheraf
import tests
import ZODB
class Model(tests.UUIDAutoModel):
counter = sheraf.CounterAttribute(default=0)
useless = sheraf.InlineModelAttribute(
sheraf.InlineModel(
foo=sheraf.SimpleAttribute(default="bar", lazy=False),... |
hikvision.py | """
pyhik.hikvision
~~~~~~~~~~~~~~~~~~~~
Provides api for Hikvision events
Copyright (c) 2016-2021 John Mihalic <https://github.com/mezz64>
Licensed under the MIT license.
Based on the following api documentation:
System:
http://oversea-download.hikvision.com/uploadfile/Leaflet/ISAPI/HIKVISION%20ISAPI_2.0-IPMD%20Servi... |
context.py | #!/usr/bin/env python3
from http import HTTPStatus
from urllib.parse import urlparse
# import socketserver
import threading
import http.server
import json
import queue
import socket
import subprocess
import time
import uuid
import string
import random
import yaml
import requests
import websocket
from sqlalchemy impor... |
email_template.py | '''
Render a template and email the result
Created on Apr 7, 2013
@author: peterb
'''
from tornado.options import define, options
import tornado.template
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
define("mailhost", default=None, help="smtp host for logging")
... |
rdg_scrape_dockets.py | GEVENT = False
import settings
from regsdotgov.document import scrape_docket
import urllib2, urllib3
import sys
import os
import traceback
from regs_models import *
import pymongo
import time
import multiprocessing
from Queue import Empty
from regs_common.mp_types import Counter
from regs_common.exceptions import Doe... |
thread_io.py | """
@author: magician
@file: thread_io.py
@date: 2020/8/7
"""
import time
from threading import Thread
import select
def factorize(number):
"""
factorize
@param number:
@return:
"""
for i in range(1, number + 1):
if number % 1 == 0:
yield i
class FactorizeThread(Thre... |
models.py | #!/usr/bin/env python3
'''Contains necessary functions, routines, and data recording for DEC model
initialization, training, validation, and inference.
William Jenkins, wjenkins [at] ucsd [dot] edu
Scripps Institution of Oceanography, UC San Diego
May 2021
'''
from datetime import datetime
import threading
import os... |
lock.py | import threading
from threading import Lock, RLock
from util.time_util import format_time
"""
多线程共享全局变量
线程时进程的执行单元,进程时系统分配资源的最小执行单位,所以在同一个进程中的多线程是共享资源的
"""
"""
由于线程之间是进行随机调度,并且每个线程可能只执行n条执行之后,当多个线程同时修改同一条数据时可能会出现脏数据,
所以出现了线程锁,即同一时刻允许一个线程执行操作。线程锁用于锁定资源,可以定义多个锁,像下面的代码,当需要独占
某一个资源时,任何一个锁都可以锁定这个资源... |
test_dht_protocol.py | import asyncio
import multiprocessing as mp
import random
import signal
from typing import List, Sequence, Tuple
import pytest
from multiaddr import Multiaddr
import hivemind
from hivemind import P2P, PeerID, get_dht_time, get_logger
from hivemind.dht import DHTID
from hivemind.dht.protocol import DHTProtocol
from hi... |
debugger_unittest.py | from collections import namedtuple
from contextlib import contextmanager
import json
try:
from urllib import quote, quote_plus, unquote_plus
except ImportError:
from urllib.parse import quote, quote_plus, unquote_plus # @UnresolvedImport
import re
import socket
import subprocess
import threading
import time
i... |
utils.py | import asyncio
from asyncio import TimeoutError
import atexit
import click
from collections import deque, OrderedDict, UserDict
from concurrent.futures import ThreadPoolExecutor, CancelledError # noqa: F401
from contextlib import contextmanager
import functools
from hashlib import md5
import html
import inspect
import... |
distributed.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Distributed helpers."""
import multiprocessing
import os
import signal
import threading
import traceback
import t... |
scripts_regression_tests.py | #!/usr/bin/env python
"""
Script containing CIME python regression test suite. This suite should be run
to confirm overall CIME correctness.
"""
import glob, os, re, shutil, signal, sys, tempfile, \
threading, time, logging, unittest, getpass, \
filecmp
from xml.etree.ElementTree import ParseError
LIB_DIR =... |
Triathlon-Analyzer.py | #!/usr/bin/python
# -*- coding: iso-8859-1 -*-
# Howto, Code license, Credits, etc: http://code.google.com/B/BCI-Project-Triathlon/
noGL = False # Set noGL to True for disabling the use of OpenGL (to gain speed, or to avoid python-wx-opengl problems)
import numpy
import wx
import math
import threading
import rando... |
at_protocol.py | #! /usr/bin/env python
# encoding: utf-8
"""
Example of a AT command protocol.
https://en.wikipedia.org/wiki/Hayes_command_set
http://www.itu.int/rec/T-REC-V.250-200307-I/en
"""
from __future__ import print_function
import sys
sys.path.insert(0, '..')
import logging
import serial
import serial.threaded
import thread... |
reminder.py | #!/usr/bin/env python
# coding: utf-8
from __future__ import (print_function, unicode_literals)
import atexit
import os
import sys
import time
import signal
import sqlite3
import subprocess
import threading
import argparse
import re
import datetime
try:
import Tkinter
except:
import tkinter as Tkinter
try:
... |
docker_registry_image_checker.py | import multiprocessing as mp
from typing import Dict
import docker
import json
from ......lib.config.log_config import WriteLogFilesToConsole
from ......lib.docker.images.image_info import ImageInfo
from ......lib.logging.abstract_log_handler import AbstractLogHandler
class DockerRegistryImageCheckerPullLogHandler... |
test_task.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Импорт библиотек
import math
import time
import cv2
import numpy as np
import rospy
import tf
try:
from clover import srv
except:
from clever import srv
from std_srvs.srv import Trigger
from mavros_msgs.srv import CommandBool
f... |
test_dist_graph_store.py | import os
os.environ['OMP_NUM_THREADS'] = '1'
import dgl
import sys
import numpy as np
import time
import socket
from scipy import sparse as spsp
from numpy.testing import assert_array_equal
from multiprocessing import Process, Manager, Condition, Value
import multiprocessing as mp
from dgl.graph_index import create_gr... |
daemon.py | import subprocess
import os
import atexit
import tempfile
import functools
import threading
import sys
import grpc
from google.rpc import status_pb2, error_details_pb2
from .servicepb.latch_pb2_grpc import DaemonStub
from .servicepb import latch_pb2 as pb
from . import exceptions
DAEMON_BINARY = os.path.join(os.path... |
app.py | from flask import Flask
import api.Controller as Controller
import logging as logger
import threading
logger.basicConfig(level="DEBUG")
flaskAppInstance = Flask(__name__)
controlInstance = None
@flaskAppInstance.route('/')
def connection_test():
return 'Flask app is accessible.'
# Create instance of threaded SD... |
MQTTLogger.py | """
____ ____ ____ _ ____ ____ __ __
| _ \ _ _ | _ \ / ___| | | ___ __ _ / ___|/ ___|\ \ / /
| |_) || | | || | | |\___ \ | | / _ \ / _` | _____ \___ \\___ \ \ \ / /
| __/ | |_| || |_| | ___) || || (_) || (_| | |_____| ___) |___) | \ V /
|_| \_... |
leech.py | from gbf_raid_bot.scenario.scenario_action import ScenarioAction, actionKeyboardPress, actionDelay
from gbf_raid_bot.scenario import Scenario
from gbf_raid_bot.twitter import TwitterClient
from gbf_raid_bot.config import ConfigReader
from gbf_raid_bot.utilities import Timer
from scenario_sets.result import WaitForResul... |
modem.py | import os, threading, time
import pexpect
from pexpect.popen_spawn import PopenSpawn
class MiniModem:
RX = 'rx'
TX = 'tx'
MODES = [RX, TX]
def __init__(self, mode, alsa_dev, baudrate=300, start=True):
if mode in MiniModem.MODES:
self.mode = mode
else:
raise Ex... |
ng_csmith_driver.py | #!/usr/bin/env python
import argparse
import os
import sys
import re
import multiprocessing
# TODO: don't hardcode the path
CSMITH_HOME = '/home/jingyue/Research/csmith-2.1.0'
def run_neongoby_offline(run_id):
print >> sys.stderr, 'Run %d' % run_id
working_dir = '%s/csmith-%d' % (workspace, run_id)
os.sy... |
basic_gpu_test.py | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.