source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
main.py | #!/bin/python
import scheduler, threading
if __name__=='__main__':
s = scheduler.Scheduler(interval=10)
measureThread = threading.Thread(target=s.syncMeasuresInterval)
configThread = threading.Thread(target=s.syncConfigInterval)
configThread.start()
measureThread.start()
|
visualizer.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of thi... |
10asul.py | # -*- coding: utf-8 -*-
import LINETCR
from LINETCR.lib.curve.ttypes import *
from datetime import datetime
# https://kaijento.github.io/2017/05/19/web-scraping-youtube.com/
import time,random,sys,json,codecs,threading,glob,requests,urllib
cl = LINETCR.LINE()
#cl.login(qr=True)
cl.login(token="EoY5Io4cmTgiz5XCPa20.bo... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
receiver.py | from functools import wraps
from greplin import scales
import celery.bin.base
import collections
import json
import logging
import sys
import threading
import time
import zbxsend
if sys.version_info < (3,):
from ConfigParser import ConfigParser
from cStringIO import StringIO
import thread
else:
from c... |
tunnel.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
bridge.py | #!/usr/bin/env python3
import carla
import os
import time, termios, tty, sys
import math
import atexit
import numpy as np
import threading
import random
import cereal.messaging as messaging
import argparse
import queue
from common.params import Params
from common.realtime import Ratekeeper
from lib.can import can_funct... |
main.py | #!/usr/bin/python
# coding=utf-8
#environment: Python 3.6
#Crawler to download doujinshi from e sit
from urllib import request, parse
import http
import re
import io
import os
import sys
from queue import Queue
from threading import Thread
import time
import urllib
from http import cookiejar
sys.stdout = io.TextIOWra... |
dependencies.py | import re
import traceback
from threading import Thread
from typing import Set, List, Tuple, Dict, Iterable, Optional
from bauh.api.abstract.handler import ProcessWatcher
from bauh.gems.arch import pacman, message, sorting, confirmation
from bauh.gems.arch.aur import AURClient
from bauh.gems.arch.exceptions import Pac... |
multitester.py | """
Certbot Integration Test Tool
- Launches EC2 instances with a given list of AMIs for different distros
- Copies certbot repo and puts it on the instances
- Runs certbot tests (bash scripts) on all of these
- Logs execution and success/fail for debugging
Notes:
- Some AWS images, e.g. official CentOS and FreeBSD... |
rdd.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... |
utils.py | # Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in wri... |
comm_tcp.py | """
This module lets the simulator communicate with external things like the
log viewer and NetVis.
"""
import comm
import socket
import json
import threading
import core
import api
class StreamingConnection (comm.NullInterface):
def __init__ (self, parent, sock):
self.sock = sock
self.parent = parent
... |
store.py | __author__ = 'ziyan.yin'
from threading import local
class Store(local):
"""
Thread local storage.
>>> d = Store()
>>> d.x = 1
>>> d.x
1
>>> import threading
>>> def f(): d.x = 2
...
>>> t = threading.Thread(target=f)
>>> t.start()
... |
service.py | """
Base types for all anchore engine services
"""
import copy
import connexion
import enum
from flask import g, jsonify
import json
import os
from pathlib import Path
import yaml
import time
import threading
import traceback
from anchore_engine.configuration import localconfig
from anchore_engine.subsys import log... |
dash_app.py | '''
This module provides the functions for creating the Dash
dashboard web application.
Reference:
https://dash.plotly.com/
'''
import requests
import time
import multiprocessing as mp
import plotly.express as px
from dash import Dash, Input, Output, dcc, html
import dash_bootstrap_components as dbc
from flask impor... |
test_capture.py | from __future__ import absolute_import, division, print_function
# note: py.io capture tests where copied from
# pylib 1.4.20.dev2 (rev 13d9af95547e)
from __future__ import with_statement
import pickle
import os
import sys
from io import UnsupportedOperation
import _pytest._code
import py
import pytest
import context... |
type_2.py | from utils import run_process
from queue import Queue, Empty
from threading import Thread
from time import sleep
# Referenced from: https://stackoverflow.com/a/4896288/3970917
def enqueue_logs(process, queue):
for line in process.stdout:
queue.put(line)
def handle_logs(proc, queue):
while proc.poll... |
test_relationship.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2019, Nigel Small
#
# 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
#
# Unle... |
__init__.py | # We import importlib *ASAP* in order to test #15386
import importlib
import importlib.util
from importlib._bootstrap_external import _get_sourcefile
import builtins
import marshal
import os
import py_compile
import random
import shutil
import subprocess
import stat
import sys
import threading
import time
import unitte... |
few_warehouses_experiment.py | from multiprocessing.context import Process
from experiment_utils import experiment_runner
"""
Experiment with only a few warehouses but a lot of customers, which would be a more realistic scenario.
"""
# for i in reversed(list(range(num_experiments))):
# print("Running experiment id ", i)
# parameters:
num_dcs =... |
MicrosoftTeams.py | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import requests
from distutils.util import strtobool
from flask import Flask, request, Response
from gevent.pywsgi import WSGIServer
import jwt
import time
from threading import Thread
from typing import... |
remote_environment.py | """
File: worker_process
Date: 9/21/19
Author: Jon Deaton (jonpauldeaton@gmail.com)
"""
from enum import Enum
from multiprocessing import Pipe, Process
class RemoteCommand(Enum):
step = 1
reset = 2
close = 3
observation_space = 4
action_space = 5
class RemoteEnvironment:
""" encapsulates ... |
videoPrediction.py | import cv2
import os
os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true'
import numpy as np
import time
from queue import Queue
from threading import Thread, Event
from .models import DetectionVideos
confthres = 0.60 # confidence threshold value
nmsthres = 0.30
yolo_path = os.path.join(os.getcwd(), "yolo_v4")
import datet... |
axis_ptz_node.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
import urllib
import urllib2
import threading
import rospy
from axis_ptz import axis_ptz
def main():
rospy.init_node("axis_ptz")
hostname = rospy.get_param("hostname", default="192.168.80.1")
username = rospy.get_param("username", default="iq... |
actor.py | import numpy as np
#from dm_control import suite
import torch
import torch.multiprocessing as mp
from collections import deque
#from PIL import Image
import random
import gym
import os
from time import sleep, time
from copy import deepcopy
#from replay_memory import ReplayMemory
from models import ActorNet, CriticNet... |
dp.py |
# This solution consists of giving each philosopher one of three states (thinking, hungry or eating).
# PHILOSOPHERS = 5
# state = ['thinking'] * PHILOSOPHERS
# sem = [Semaphore(0) for _ in range(PHILOSOPHERS)]
# mutex = Semaphore(1)
# sem indicates whether a philosopher can start eating or not.
# mutex is used so th... |
pycli_music.py | #!/usr/bin/env python
from pathlib import Path
import os
import sys
import time
import json
import signal
import shutil
import random
import subprocess
import threading
import musicformat
class PlayerNotFound(Exception):
pass
class ProberNotFound(Exception):
pass
class Player:
def __init__(self, filen... |
imgaug.py | from __future__ import print_function, division, absolute_import
import random
import numpy as np
import copy
import numbers
import cv2
import math
from scipy import misc, ndimage
import multiprocessing
import threading
import traceback
import sys
import six
import six.moves as sm
import os
from skimage import draw
imp... |
rp1_test_server.py | from math import pi
from rp1controller.odometry_system import VelocityPose
from inputs import get_gamepad
from rp1controller import Target
import socket, pickle, threading
from time import sleep
IP_laptop = "192.168.137.1"
axis_FB = "ABS_Y"
axis_LR = "ABS_X"
axis_rot = "ABS_RX"
axis_deadzone = 0.2
butt... |
depthai_utils.py | #Created by Luxonis
#Modified by Augmented Startups - 18/12/2020
#Watch the tutorial Series here : http://bit.ly/OAKSeriesPlaylist
import logging
from pathlib import Path
import threading
import cv2
import depthai
from imutils.video import FPS
from RpiMotorLib import RpiMotorLib
import time
#define GPIO pins
GPIO_pin... |
vncexec.py | #!/usr/bin/env python
#
# Execute powershell VNC agent (Invoke-Vnc.ps1) via WMI
# Supports uploading via SMB or downloading via HTTP
#
# Author:
# Artem Kondratenko (@artkond)
#
# Based on https://github.com/CoreSecurity/impacket/examples/
# Kudos to @asolino
#
#
#!/usr/bin/python
import zlib
import base64
import o... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
envs_runner.py | import numpy as np
import torch
import IPython
from multiprocessing import Process, Pipe
from IPython.core.debugger import set_trace
def worker(child, env):
"""
Worker function which interacts with the environment over remote
"""
try:
while True:
# wait cmd sent by parent
... |
tasks.py | import inspect
import itertools
import os
import sys
import threading
import time
from contextlib import contextmanager
from enum import Enum
from pathlib import Path
from tempfile import NamedTemporaryFile
from typing import Optional, List
from invoke import task, Context
DAEMON_DIR: str = "daemon"
DEFAULT_PREFIX: s... |
rabbit.py | """
Classes for working with RabbitMQ message queues. Support for three types of
queues is provided.
1. ``MessageQueue`` -- a message queue for implementing the producer/consumer
pattern.
#. ``Broadcaster`` -- used to send messages to all registered listeners.
#. ``MessageBus`` -- used to send messages to a specific l... |
licence.py | """Licencja Otwartej Gry"""
import os
import queue
import threading
from os.path import normpath, join
from PySide2.QtCore import QSize
from PySide2.QtGui import QFont, QIcon
from PySide2.QtWidgets import QWidget, QApplication, QVBoxLayout, QTextBrowser
from compress_txt import gzip_read
class Licence(QWidget):
... |
train.py | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
metrics.py | from __future__ import absolute_import
__all__ = ['timing', 'incr']
import logging
from contextlib import contextmanager
from django.conf import settings
from random import random
from time import time
from threading import Thread
from six.moves.queue import Queue
def get_default_backend():
from sentry.utils.i... |
GetChain_test.py | """
GetChain_test.py
This test is responsible for testing the get chain and get paginated
chain functionality.
2020 Stephen Pacwa and Daniel Okazaki
Santa Clara University
"""
# Standard library imports
from threading import Thread
# Local imports
from tasks import get_chain, get_chain_paginated
from tests.constant... |
test_socket.py | import unittest
from test import support
import errno
import io
import socket
import select
import tempfile
import time
import traceback
import queue
import sys
import os
import array
import platform
import contextlib
from weakref import proxy
import signal
import math
import pickle
import struct
try:
import multi... |
test_index.py | import multiprocessing as mp
import os
import time
import unittest
import numpy as np
from jina.drivers.helper import array2pb
from jina.enums import FlowOptimizeLevel
from jina.executors.indexers.vector.numpy import NumpyIndexer
from jina.flow import Flow
from jina.main.parser import set_flow_parser
from jina.proto i... |
test_itertools.py | import unittest
from test import support
from itertools import *
import weakref
from decimal import Decimal
from fractions import Fraction
import operator
import random
import copy
import pickle
from functools import reduce
import sys
import struct
import threading
import gc
maxsize = support.MAX_Py_ssize_t
minsize = ... |
test_io.py | from __future__ import division, absolute_import, print_function
import sys
import gzip
import os
import threading
from tempfile import mkstemp, NamedTemporaryFile
import time
import warnings
import gc
from io import BytesIO
from datetime import datetime
import numpy as np
import numpy.ma as ma
from numpy.lib._iotool... |
trezor-t-emu.py | import os
import subprocess
import sys
import logging
import time
import threading
import PyQt5.QtWidgets as qwi
def execute_trezor_emu(emulator_base_dir: str, profile_dir: str):
env = os.environ
env['BROWSER'] = 'chromium'
env['TREZOR_PROFILE'] = profile_dir
start_sh = 'emu.sh'
try:
p = ... |
keylogger.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
'Keylogger (Build Your Own Botnet)'
# standard library
import os
import sys
import time
import threading
try:
from StringIO import StringIO # Python 2
except ImportError:
from io import StringIO # Python 3
# packages
if sys.platform == 'win32':
import pyH... |
test_operator.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... |
main.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from jd_assistant import Assistant
from util import parse_sku_id
import threading
if __name__ == '__main__':
"""
重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇
https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%... |
demo_mysql.py | # -*- coding: utf-8 -*-
# from gevent import monkey
#
# monkey.patch_all()
#
# import gevent
import pymysql
import threading
from queue import Queue
class MysqlManager(object):
def __init__(self, host, port, user, password, database):
self.host = host
self.port = port
self.user = user
... |
tests.py | import os
import re
import tempfile
import threading
import unittest
from pathlib import Path
from unittest import mock
from django.db import NotSupportedError, connection, transaction
from django.db.models import Aggregate, Avg, CharField, StdDev, Sum, Variance
from django.db.utils import ConnectionHandler
from djang... |
stockcollector.py | import json
import threading
import datetime
from QAPUBSUB.consumer import subscriber_routing
from QAPUBSUB.producer import publisher, publisher_routing
from QARealtimeCollector.setting import eventmq_ip
from QUANTAXIS.QAARP.QAUser import QA_User
from QUANTAXIS.QAEngine.QAThreadEngine import QA_Thread
from QUANTAXIS.Q... |
cli.py | # -*- coding: utf8 -*-
"""
Icecake
This module provides a simple static site builder, similar to pelican or
octopress. It is intended to be small, light, and easy to modify. Out of the box
it sports the following features:
- Markdown formatting
- Pygments source code highlighting
- Jinja templates
- Automatically reb... |
2.1.thread_safe_read.py |
'''
说明: 多线程安全例子: 只对共享变量做读操作
'''
from queue import Queue
from threading import Thread
from typing import List
def req(res_value: Queue, loop_count_list: List, i: int):
total = 0
for i in range(loop_count_list[i]):
total += 1
res_value.put(total)
def main(thread_count: int, loop_count_list: List)... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
optimizer.py | import multiprocessing as mp
from awrams.utils.messaging import Message
from awrams.utils.nodegraph.nodes import funcspec_to_callable
from collections import OrderedDict
import numpy as np
import threading
import time
import sys
from queue import Empty, Queue
class OptimizerProcess(mp.Process):
def __in... |
block.py | # Copyright (c) 2016, The Bifrost Authors. All rights reserved.
# Copyright (c) 2016, NVIDIA CORPORATION. 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 re... |
test_win_runas.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import textwrap
import subprocess
import socket
import inspect
import io
# Service manager imports
import sys
import os
import logging
import threading
import traceback
import time
import yaml
from tests.support.case import ModuleCase
fr... |
http.py | from __future__ import print_function
from builtins import str
from builtins import object
import logging
import base64
import sys
import random
import string
import os
import ssl
import time
import copy
import json
import sys
from pydispatch import dispatcher
from flask import Flask, request, make_response, send_from_... |
test_arrow.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
sentiments.py | # -*- coding: utf-8 -*-
from snownlp import SnowNLP
import codecs
import pandas as pd
import datetime
import os
import jieba
import jieba.analyse
import multiprocessing
import time
def convertDate(t):
td = datetime.datetime.strptime(t,"%m月%d日 %H:%M")
return td.strftime("%d"),td.strftime("%m")
def convertTime(... |
tree-L-dynamic.py | # -*- coding: utf-8 -*-
import pairing_heap as pheap
from copy import deepcopy,copy
import threading
import Queue
import requests
from requests.auth import HTTPDigestAuth
import json
import sys
import communication
import config
import time
import tree_L_sprit
# グローバル変数の宣言
LIMIT_SELECTION = 0
SELECTON_RATE = 0
EXCHANG... |
ubxpoller.py | """
ubxpoller.py
This example illustrates a simple implementation of a
'pseudo-concurrent' threaded UBXMessage configuration
polling utility.
(NB: Since Python implements a Global Interpreter Lock (GIL),
threads are not truly concurrent.)
It connects to the receiver's serial port and sets up a
UBXReader r... |
threading_mylocals.py | #!/usr/bin/env python
# encoding: UTF-8
import threading
import random
import logging
logging.basicConfig(
level=logging.DEBUG,
format='(%(threadName)-10s) %(message)s',
)
def show_value(data):
try:
val=data.value
except AttributeError:
logging.debug('No value yet')
else:
... |
context_search.py | # -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
from random import shuffle
from time import sleep
from search import Search
from db import DataSearch
from threading import Thread, stack_size
import os
import pandas as pd
stack_size(134217728)
class ContextSearch(object):
... |
writer.py | import os
import time
from threading import Thread
from queue import Queue
import cv2
import numpy as np
import torch
import torch.multiprocessing as mp
from alphapose.utils.transforms import get_func_heatmap_to_coord
from alphapose.utils.pPose_nms import pose_nms, write_json
DEFAULT_VIDEO_SAVE_OPT = {
'savepath... |
GetLocationDataForTest.py | import sys
import os
import ssl
import time
import json
import MySQLdb
from datetime import datetime
import socket
import random
import threading
class GetSvaData():
isError = False
nowTime = datetime.now()
appname = ""
brokeip = ""
brokerport = ""
queueid = ""
companyid = ""
def __... |
AnomalyServer.py | """The module containing the ML-Server. Can be run to start
the server, expects a port as argument."""
import time
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
import base64
from tensorflow import keras
from threading import Thread
import os
import tensorflow as tf
from sys import argv
import... |
datasets.py | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from utils.utils import xyxy2xywh, xywh2xyxy
help_url =... |
drone.py | #Subproccess launch moduel - STDIN / STDOUT Communication
version = 2.0
last_edit = [4,1,2022]
import os, subprocess, io, time
from threading import Thread
#Subprocess Class
class Drone:
"Class for launching subprocess of ATK"
"WARNIG, version 2.0 ONLY"
"This version will only hook in ... |
mission.py | import os
import requests
import threading
import subprocess as sp
import rospy
from rospy import Service
from std_srvs.srv import (Empty, EmptyRequest, EmptyResponse)
from mission.camera.ClientOnDemandComponent import ClientOnDemandComponent
class Mission:
__dir_path = None
__camera_ondemand_controller: Cli... |
__init__.py | from __future__ import print_function
import sys
if sys.version_info[0] < 3:
print("pkuseg does not support python2", file=sys.stderr)
sys.exit(1)
import os
import time
import pickle as pkl
import multiprocessing
from multiprocessing import Process, Queue
from . import trainer
from . import inference as _in... |
managers.py | #
# Module providing the `SyncManager` class for dealing
# with shared objects
#
# multiprocessing/managers.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ]
#
# Imports
#
import sys
import threading
import ar... |
installwizard.py | # Copyright (C) 2018 The Electrum developers
# Distributed under the MIT software license, see the accompanying
# file LICENCE or http://www.opensource.org/licenses/mit-license.php
import os
import sys
import threading
import traceback
from typing import Tuple, List, Callable, NamedTuple, Optional
from PyQt5.QtCore i... |
bot.py | import socket
import string
import os, sys
import logging, coloredlogs
from threading import Thread
from random import choice
from time import sleep
from modules.commandmanager import CommandManager
from modules.command import Command
from modules.timer import Timer
from modules.config import *
from modules.commandtex... |
utility.py | import os
import math
import time
import datetime
from multiprocessing import Process
from multiprocessing import Queue
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import imageio
import torch
import torch.optim as optim
import torch.optim.lr_scheduler as lrs
import pdb
... |
recorder.py | import re
import time
import pprint
import tkinter
import threading
import traceback
from pynput.mouse import Listener as mlistener
from pynput.mouse import Controller as mcontroller
from pynput.keyboard import Key
from pynput.keyboard import Listener as klistener
from pynput.keyboard import Controller as kcontroller
... |
handlers.py | # Copyright 2001-2016 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this perm... |
UDPClient.py | # This class was created by Angus Clark for the NetHealth Project (TN2)
import sys
import json
import time
import socket
import numpy
from threading import Thread
class UDPClient:
def __init__(self, addr, number_of_reflects = 2):
self.addr = addr
self.port = -1 # Change on port allo... |
__init__.py | """Provides a graphical user interface to select the grounding for a
set of longforms.
"""
import os
import json
import time
import shutil
import logging
import tempfile
import webbrowser
from multiprocessing import Process
logger = logging.getLogger(__name__)
def ground_with_gui(longforms, scores, grounding_map=Non... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
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... |
build.py | #!/usr/bin/env python3
import argparse
import binascii
import collections.abc
import contextlib
import errno
import itertools
import json
import logging
import os
import pickle
import platform
import queue
import shutil
import subprocess
import sys
import threading
import time
from multiprocessing import Process, cpu_c... |
multiprocess_iterator.py | from __future__ import division
import collections
import datetime
import multiprocessing
from multiprocessing import sharedctypes
import signal
import sys
import threading
import warnings
import numpy
import six
from chainer.dataset import iterator
from chainer.iterators.order_samplers import ShuffleOrderSampler
_... |
bcp_client.py | """BCP Server interface for the MPF Media Controller"""
import logging
import queue
import socket
import threading
import os
import select
from datetime import datetime
import math
import mpf.core.bcp.bcp_socket_client as bcp
from PyQt5.QtCore import QTimer
class BCPClient(object):
def __init__(self, mpfmon,... |
test_cpu_usage.py | #!/usr/bin/env python3
import time
import threading
import _thread
import signal
import sys
import cereal.messaging as messaging
import selfdrive.manager as manager
def cputime_total(ct):
return ct.cpuUser + ct.cpuSystem + ct.cpuChildrenUser + ct.cpuChildrenSystem
def print_cpu_usage(first_proc, last_proc):
pr... |
utils.py | #!/usr/bin/env python3
#
# Electron Cash - lightweight Bitcoin Cash client
# Copyright (C) 2012 thomasv@gitorious
#
# This file is:
# Copyright (C) 2018 Calin Culianu <calin.culianu@gmail.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated document... |
llh_server.py | #!/usr/bin/env python
"""
Server(s) for handling llh requests from a client: client passes free param
values, server sets these on its DistributionMaker, generates outputs, and
compares the resulting distributions against a reference template, returning
the llh value.
Code adapted from Dan Krause
https://gist.githu... |
scenario_generator.py | import sys, os, glob, random, threading, time, pickle, datetime
from enum import Enum
from situation_assessment import _assess_one_obj_threat_score
from situation_assessment import _score_2_threat_degree
from situation_assessment import comfort_level_scores
from situation_assessment import safety_degree
from obj_state ... |
pipe_test.py | import time
from multiprocessing import Process, Pipe
def f(conn):
time.sleep(3)
conn.send([42, None, 'hello'])
conn.close()
if __name__ == '__main__':
parent_conn, child_conn = Pipe()
p = Process(target=f, args=(child_conn,))
p.start()
print(parent_conn.recv()) # prints "[42, None, 'h... |
webcamvideostream.py | # import the necessary packages
from threading import Thread
import cv2
class WebcamVideoStream:
def __init__(self, src=0, name="WebcamVideoStream"):
# initialize the video camera stream and read the first frame
# from the stream
self.stream = cv2.VideoCapture(src)
(self.grabbed, self.frame) = self.stream.rea... |
miner.py | import sys
import socket
import threading
from blockchain import Block
from uuid import uuid4
import random
from pickle import dumps, loads
from ecdsa import SigningKey
from ecdsa.keys import VerifyingKey
from hashutils import hash_object
class Miner:
# Trusted entity that verifies integrity of transactions
#... |
callbacks_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... |
newClient.py | __author__ = 'tanel'
import argparse
from ws4py.client.threadedclient import WebSocketClient
import time
import threading
import sys
import urllib
import Queue
import json
import time
import os
from math import exp
def rate_limited(maxPerSecond):
minInterval = 1.0 / float(maxPerSecond)
def decorate(func):
... |
owlish_run.py | import threading
from threading import Thread
from bluepy.btle import Scanner, DefaultDelegate
import time
from send_twilio import send_twilio
from upload_cloudinary import upload_cloudinary
import picamera
from detect_picamera import main, q
activate_status = False
class ScanDelegate(DefaultDelegate):
def __init_... |
watch_directory.py | """Working example of the ReadDirectoryChanges API which will
track changes made to a directory. Can either be run from a
command-line, with a comma-separated list of paths to watch,
or used as a module, either via the watch_path generator or
via the Watcher threads, one thread per path.
Examples:
watch_director... |
thread.py | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
silex.engines.thread
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
基于thread的各种engine
:author: lightless <root@lightless.me>
:homepage: None
:license: GPL-3.0, see LICENSE for more details.
:copyright: Copyright (c) 2017-2019 lightless. All rights res... |
test_leaks.py | import unittest
import sys
import gc
import time
import weakref
import greenlet
import threading
class ArgRefcountTests(unittest.TestCase):
def test_arg_refs(self):
args = ('a', 'b', 'c')
refcount_before = sys.getrefcount(args)
g = greenlet.greenlet(
lambda *arg... |
SshTunnel.py | import os
import random
import string
import subprocess
import multiprocessing
import time
import inspect
file_name = "./" + ''.join(random.choices(string.ascii_uppercase + string.digits, k=5)) + ".tmp"
class RunSSH:
def __init__(self, port):
self.ssh_thread = None
self.pipe = None
self.s... |
basecrawl.py | from exception import Type,TeleException
from abc import ABC, abstractmethod
from config import Config
import multiprocessing
import queue
import _thread
class BaseCrawl:
def __init__(self, name, description, config_path = 'config.ini', queue_size = 10000):
self.name = name
self.desc = description
... |
collect_data.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: loveNight
# @Date: 2015-10-28 19:59:24
# @Last Modified by: roachsinai
# @Last Modified time: 2018-03-29 16:44:38
import urllib
import requests
import os
import re
import time
import threading
from datetime import datetime as dt
from multiprocessing.dummy i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.