source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
atomic_action.py | from abc import ABCMeta, abstractmethod
from threading import Thread, Lock
class AtomicAction(object):
__metaclass__ = ABCMeta
OUTCOMES = ("succeeded", "preempted", "failed")
SUCCEEDED, PREEMPTED, FAILED = OUTCOMES
def __init__(self, name, params=None):
self.name = name
self.params =... |
app.py | import requests, os, json
from threading import Thread
from time import sleep, time
import random, os
# create the wallet
shard = random.randint(1, 5)
print("Using shard ", str(shard))
os.system("./dexmd mw wal.json " + str(shard))
validator = requests.get("http://35.211.241.218:5000/start_validator").text
validator... |
gui.py | import external.PySimpleGUI as sg
from external.phue import Bridge
from data import images
import acc
import iracing
import threading
import json
import time
# Global Variables
SAVE_FILE_PATH = './phue-rf-save.json'
HUE_CONNECTION = {
'ip': '',
'lights': [],
'brightness': 255,
'sim': 'ACC'
}
STOP_SYNC... |
qualys.py | from requests.auth import HTTPBasicAuth
import requests
import xmltodict, json
import ast
import time
from multiprocessing import Process
import boto3
import os
auth = HTTPBasicAuth(username, password)
option_title = option
ip_network_id = network_id
iscanner_name = scanner_name
mis_sqs_secret = os.environ.get('MIS_... |
apschedule_demo.py | # 定时任务demo
from subprocess import call
from apscheduler.schedulers.background import BackgroundScheduler
import time
import os
from multiprocessing import Process, Queue
# 这个提示虽然可以用,但不够好用, 还会消失..
def mac_time():
cur_format_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
time_title = "报警时间"
c... |
tornado_app.py | #*********************************************************************
# ESP8266ARS: Python project for WebTornadoDS
#
# Author(s): Daniel Roldan <droldan@cells.es>
#
# Copyright (C) 2017, CELLS / ALBA Synchrotron
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... |
server.py | #!/usr/bin/env python3
import socket
import os
import sys
import traceback
import random
import time
from threading import Thread
PORT = int(os.environ.get("PORT", 6969))
flag = open('flag.txt', 'r').readline()
def client_thread(conn, ip, port, MAX_BUFFER_SIZE = 4096):
RANDOM_NUMBER = random.randint(0, 1000000)
... |
test_capi.py | # Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
from collections import OrderedDict
import _thread
import importlib.machinery
import importlib.util
import os
import pickle
import random
import re
import subprocess
impo... |
config_vios.py | #!/usr/bin/env python3
# scripts/config_vios.py
#
# Import/Export script for vIOS.
#
# @author Andrea Dainese <andrea.dainese@gmail.com>
# @copyright 2014-2016 Andrea Dainese
# @license BSD-3-Clause https://github.com/dainok/unetlab/blob/master/LICENSE
# @link http://www.unetlab.com/
# @version 20160719
import getopt... |
find_commit_with_best_gold_results.py | #! /usr/bin/env python
# Copyright 2019 Google LLC.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import os
import re
import subprocess
import sys
import threading
import urllib
import urllib2
assert '/' in [os.sep, os.altsep]
skia_directory = os.... |
engine.py | """
Event-driven framework of vn.py framework.
"""
import re
from collections import defaultdict
from queue import Empty, Queue
from threading import Thread
from time import sleep, time
from typing import Any, Callable, List
from numpy import array
from vnpy.trader.setting import get_settings
from kafka import Kafka... |
main.py | import os
import re
import socket
import threading
from librespot.audio.decoders import AudioQuality
from librespot.core import Session
from librespot.metadata import TrackId
from librespot.player.codecs import VorbisOnlyAudioQuality
session: Session
sock: socket
def handler(client: socket.socket, address: str):
... |
GenerativeDetector.py | import cv2
import numpy as np
import time
from abc import ABC, abstractmethod
from threading import Thread
from cv2 import VideoCapture
from multiprocessing import Queue, Process
from multiprocessing import Value
from OpenPersonDetector import OpenPersonDetector
from newgen.TrackJoin import TrackJoin
class PersonDe... |
main.py | import os
import time
import threading
from dotenv import load_dotenv
from azure.iot.device import Message
from generator import Humidity, Temperature
import listener
# Get variables from dotenv
load_dotenv()
DEVICE_ID = os.getenv("DEVICE_ID")
# Define the default value
LIMIT_GROWING_DAYS = 40 # The maximum number... |
hiksound.py | import urllib.request
import xml.etree.ElementTree as ET
import threading
import queue
import http.client
import time
import socket
# A horrible hack, so as to allow us to recover the socket we still need from urllib
class SocketGrabber:
def __init__(self):
self.sock = None
def __enter__(self):
self._temp = sock... |
imageme.py | #!/usr/bin/python
"""
imageMe is a super simple image gallery server.
Run imageme.py from the top level of an image directory to generate gallery
index HTML and run a SimpleHTTPServer on the localhost.
Imported as a module, use imageme.serve_dir(your_path) to do the same for any
directory programmatically. When run a... |
wsconnector.py | from threading import Thread, Lock
from websocket import WebSocketApp, setdefaulttimeout, ABNF
from msgpack import packb, unpackb
from ssl import CERT_NONE
class WSConnector:
class REID:
def __init__(self):
self._next = 0
def __next__(self):
n = self._next
sel... |
__init__.py | # -*- coding: utf-8 -*-
"""The initialization file for the Pywikibot framework."""
#
# (C) Pywikibot team, 2008-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import unicode_literals
__release__ = '2.0b3'
__version__ = '$Id: febe9736b00037cc7c4a06ff9bd4ba3cff4ae5bb $'
import datetime
impo... |
multi.py | import torch
import torch.multiprocessing as mp
import subprocess
import time
import numpy as np
from tqdm import tqdm, trange
from triton_inference.measure import ModelMetricsWriter
def monitor():
writer = ModelMetricsWriter("/jmain01/home/JAD003/sxr06/lxx22-sxr06/model-inference/tritonserver", "stress")
whi... |
quantize_tinyYOLO_BAC_multiprocess.py | #!/usr/bin/env python
# --------------------------------------------------------
# Quantize Fast R-CNN based Network
# Written by Chia-Chi Tsai
# --------------------------------------------------------
"""Quantize a Fast R-CNN network on an image database."""
import os
os.environ['GLOG_minloglevel'] = '2'
import _... |
commands.py | ###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009-2010,2015, James McCoy
# 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 a... |
mis_game.py | from mis_util import *
from threading import Thread
import socket
from math import floor, sqrt
def clamp_and_bound(pos, dx, dy, bounds):
if len(bounds) != 4:
raise ValueError
min_x = bounds[0]
max_x = bounds[1]
min_y = bounds[2]
max_y = bounds[3]
#should dx push the positi... |
test_zmq.py | import multiprocessing
import pytest
import pythonflow as pf
def run_processor():
with pf.Graph() as graph:
x = pf.placeholder('x')
a = pf.placeholder('a')
y = (a * x).set_name('y')
with pf.Processor.from_graph('tcp://127.0.0.1:5555', 'tcp://127.0.0.1:5556', graph) as processor:
... |
wsdump.py | #!/Users/yifan/IdeaProjects/tidbbeat/build/ve/darwin/bin/python3.9
import argparse
import code
import sys
import threading
import time
import ssl
import six
from six.moves.urllib.parse import urlparse
import websocket
try:
import readline
except ImportError:
pass
def get_encoding():
encoding = getattr... |
remote.py | """
fs.remote
=========
Utilities for interfacing with remote filesystems
This module provides reusable utility functions that can be used to construct
FS subclasses interfacing with a remote filesystem. These include:
* RemoteFileBuffer: a file-like object that locally buffers the contents of
... |
supervised_popen.py | # Software License Agreement (BSD License)
#
# Copyright (c) 2012, Fraunhofer FKIE/US, Alexander Tiderko
# 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 mus... |
main.py | #! /usr/bin/env python
# noted by chan
#orion -v --debug hunt -c ./orion_config.yaml -n ppo_test ./algorithms/ppo/main.py --epochs~'fidelity(5000, 10000)' --lr~'uniform(1e-5, 1)'
import os
import torch
import numpy as np
from torch.multiprocessing import SimpleQueue, Process, Value, Event, Barrier
import torch.distrib... |
Cluster.py | __author__ = 'cmantas'
from lib.tiramola_logging import get_logger
from multiprocessing import Process
from lib.persistance_module import get_script_text, home, env_vars
class Cluster(object):
# the logger for this file
log = get_logger('CLUSTER', 'DEBUG', logfile=home+'files/logs/Coordinator.log')
def _... |
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... |
compound.py | #!/usr/bin/env python3
"""Cyberjunky's 3Commas bot helpers."""
import argparse
import configparser
import json
import logging
import os
import queue
import sqlite3
import sys
import threading
import time
from logging.handlers import TimedRotatingFileHandler as _TimedRotatingFileHandler
from pathlib import Path
import ... |
evaluate.py | from TTS.text2speech import tts_class
from multiprocessing import Process
import faiss
import time
import sqlite3
import csv
import random
import copy
import tensorflow_hub as hub
import tensorflow_text
import math
import numpy as np
import pickle
from Retriever.Retrieve import retrieve
import Utils.functions as utils
... |
teleoperator.py |
#############################################################################
# DEVELOPED BY KANISHK #############
# THIS SCRIPT CONSTRUCTS A TELEOPERATOR CLASS #############
#############################################################################
# Libr... |
MockSocketProgram.py | #Mock socket program with multithreading
import threading
import time
PORT = 5050
SERVER = "195.888.756"
ADDR = (SERVER, PORT)
names = ["steven", "jon", "sarah"]
address = [("195.888.7.56", 4040), ("192.168.1.26", 3030), ("196.888.1.56", 2020)]
messages = ["steven: Sent a concern", "jon: Ordered a package", "sarah: M... |
test_events.py | """Tests for events.py."""
import collections.abc
import concurrent.futures
import functools
import gc
import io
import os
import platform
import re
import signal
import socket
try:
import ssl
except ImportError:
ssl = None
import subprocess
import sys
import threading
import time
import errno
import unittest
... |
XInput_edit.py | #!/usr/bin/env python2.7
import ctypes, ctypes.util
from ctypes import Structure, POINTER
from math import sqrt
import time
from threading import Thread, Lock
# loading the DLL #
XINPUT_DLL_NAMES = (
"XInput1_4.dll",
"XInput9_1_0.dll",
"XInput1_3.dll",
"XInput1_2.dll",
"XInput1_1.dll"
)
libXI... |
eval_utils.py | import argparse
import json
import os
import random
from typing import Counter
from tqdm import tqdm
from PIL import Image
import numpy as np
import voc12.data
from torch.utils.data import DataLoader
from tool import pyutils, imutils, torchutils
import importlib
from torchvision import transforms
import torch
import to... |
PortScanner.py | import threading
import socket
from Sources.PortList import *
openPorts = []
def portScanThread(target, port):
global openPorts
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(0.5)#
try:
con = s.connect((target,port))
openPorts.append(port)
con.close()
e... |
client.py | import socket
import json
import time
import collections
import threading
import h2.connection
import h2.events
host = socket.gethostname()
port = 6001
class Client:
def __init__(self, client_id):
self.client_id = client_id
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
... |
workers.py |
import multiprocessing
class holderClass():
def __init__(self):
self.x = 12
def increment(self,in_q,out_q):
while in_q:
object_class = in_q.get()
object_class.x = object_class.x + 1
out_q.put(object_class)
class testClass():
def __init__(self):... |
base.py | # -*- coding: utf-8 -*-
import uuid
import enum
import abc
import threading
import queue
import datetime
import logging
import argparse
_MOD_LOGGER = logging.getLogger(__name__)
from .errors import LeetPluginError, LeetError
class LeetJobStatus(enum.Enum):
'''Flags the status of an individual job.
How are t... |
ternjs.py | # pylint: disable=E0401,C0111,R0903
import os
import re
import json
import platform
import subprocess
import threading
from urllib import request
from urllib.error import HTTPError
from urllib.error import URLError
from deoplete.source.base import Base
is_window = platform.system() == "Windows"
import_re = r'=?\s*... |
_reloader.py | import os
import sys
import time
import subprocess
import threading
from itertools import chain
from werkzeug._internal import _log
from werkzeug._compat import PY2, iteritems, text_type
def _iter_module_files():
"""This iterates over all relevant Python files. It goes through all
loaded files from modules,... |
http.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 use ... |
threading.py | import multiprocessing
def async(func):
"""
A decorator to make a function asynchronous,
using the multiprocessing python lib.
:param func: the function to decorate
"""
def wrapped(*args, **kwargs):
process = multiprocessing.Process(target=func, args=args, kwargs=kwargs)
p... |
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... |
django.py | import json
import logging
import os
import threading
from django.http import HttpResponse, HttpRequest
from . import utils
from .httpbased import HttpContext, HttpHandler, run_event_loop
from .utils import make_applications, cdn_validation
from ..utils import STATIC_PATH, iscoroutinefunction, isgeneratorfunction, ge... |
comm.py | """
comm.py:
This is the F prime communications adapter. This allows the F prime ground tool suite to interact with running F prime
deployments that exist on the other end of a "wire" (some communication bus). This is done with the following mechanics:
1. An adapter is instantiated to handle "read" and "write" functi... |
eventSplashWindow.py | #-*- coding:utf-8 -*-
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtNetwork import *
from uiEvents.AWindowBase import *
from uiDefines.Ui_SplashWindow import *
from uiUtil.envs import *
from uiUtil.globaltool import *
import os
import sys
import pathlib
import datetime
... |
exchange_rate.py | from datetime import datetime
import inspect
import requests
import sys
import os
import json
import pkgutil
from threading import Thread
import time
import csv
import decimal
from decimal import Decimal as PyDecimal # Qt 5.12 also exports Decimal
from .bitcoin import COIN
from .i18n import _
from .util import PrintE... |
test_error.py | # Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
from threading import Thread
import zmq
from zmq import Again, ContextTerminated, ZMQError, strerror
from zmq.tests import BaseZMQTestCase
class TestZMQError(BaseZMQTestCase):
def test_strerror(self):
"""test tha... |
compare_num_layer_w_multiprocessing_sgd.py | import qiskit
import numpy as np
import sys
import multiprocessing
sys.path.insert(1, '../')
import qtm.base, qtm.constant, qtm.nqubit, qtm.fubini_study, qtm.encoding
def run_w(num_layers, num_qubits):
thetas = np.ones(num_qubits*num_layers*5)
qc = qiskit.QuantumCircuit(num_qubits, num_qubits)
loss_values... |
graphicsCrawlerDisplay.py | # graphicsCrawlerDisplay.py
# -------------------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a lin... |
tello_base.py | import socket
import threading
import time
import numpy as np
import libh264decoder
from stats import Stats
class Tello:
"""Wrapper class to interact with the Tello drone."""
def __init__(self, local_ip, local_port, imperial=False, command_timeout=.3, tello_ip='192.168.10.1',
tello... |
listeners.py | import os.path
import sys
from threading import Thread
from django.conf import settings
from django.db.models import signals as model_signals
try:
from filebrowser.views import filebrowser_post_upload
from filebrowser.views import filebrowser_post_rename
from filebrowser.views import filebrowser_post_dele... |
job_server.py |
import atexit
import cProfile
import ctypes
import errno
import json
import os
import shutil
import signal
import socket
import sqlite3
import struct
import sys
import threading
import traceback
import tracemalloc
from datetime import datetime
from glob import glob
from importlib import reload
from multiprocessing imp... |
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... |
heartmates.py | # PennApps
from flask import Flask, jsonify, render_template, request
import csv
import json
import requests
from requests.auth import HTTPBasicAuth
from threading import Thread
app = Flask(__name__)
@app.route('/')
def home():
'''This is what you will see if you go to http://127.0.0.1:5000'''
return render... |
test_socket.py | import io
import time
import unittest
from unittest import mock
import pytest
from engineio import exceptions
from engineio import packet
from engineio import payload
from engineio import socket
class TestSocket(unittest.TestCase):
def setUp(self):
self.bg_tasks = []
def _get_mock_server(self):
... |
utils.py | from PIL import Image
import os
import shutil
import pandas as pd
import threading
import numpy as np
from keras.preprocessing.image import img_to_array, load_img
def load_image(label, path, q=None):
"""
label in here is a real number.
load image and put in a Queue.
"""
img = load_img(path)
ar... |
main.py | import sys
sys.path.append('./personalized-instagram-scraper/')
from igramscraper.instagram import Instagram
import argparse
import pandas as pd
import threading
from time import sleep
from igramscraper.exception import *
def instagram_login(username: str, password: str):
"""
This is a function that permit th... |
tcpserver.py | import socket
import threading
class TCPserver():
def __init__(self,ip,port):
self.server_ip=ip
self.server_port=port
def Server(self):
#creating server
server = socket.socket(socket.AF_INET , socket.SOCK_STREAM)
server.bind((self.server_ip,self.server_port))
... |
netdjango_connect_processes.py | #!/usr/bin/env python
from netmiko import ConnectHandler
from datetime import datetime
from net_system.models import NetworkDevice, Credentials
import django
from multiprocessing import Process, current_process
import time
def main():
django.setup()
start_time = datetime.now()
devices = NetworkDevice.... |
soc_net_bench.py | #! /usr/bin/env python
#
# ===============================================================
# Description: Benchmark to emulate TAO workload.
#
# Created: 2014-04-17 10:47:00
#
# Author: Ayush Dubey, dubey@cs.cornell.edu
#
# Copyright (C) 2013-2014, Cornell University, see the LICENSE
# ... |
arduscope.py | # -*- coding: utf-8 -*-
from __future__ import annotations
import calendar
import json
import os
import pathlib
import threading
import time
from collections import deque
from dataclasses import dataclass, field, asdict
from tqdm import tqdm
from typing import List, Dict
import matplotlib.pyplot as plt
import numpy ... |
lisp-rtr.py | # -----------------------------------------------------------------------------
#
# Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com>
#
# 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... |
stream.py | """ Read audio stream, and play it, using installed vlc player (libvlc) """
# python standard lib
import sys
import os
import time
from typing import List
import ctypes
from subprocess import Popen, PIPE
from multiprocessing import Process, Queue
import logging
# externals
main_logger = logging.getLogger("main")
de... |
futu_gateway.py | """
Please install futu-api before use.
"""
from copy import copy
from collections import OrderedDict
from datetime import datetime
from threading import Thread
from time import sleep
from futu import (
KLType,
ModifyOrderOp,
TrdSide,
TrdEnv,
OpenHKTradeContext,
OpenQuoteContext,
OpenUSTra... |
visualizer.py | import math
import numpy as np
import threading
import open3d as o3d
from open3d.visualization import gui
from open3d.visualization import rendering
from collections import deque
from .boundingbox import *
from .colormap import *
from .labellut import *
import time
class Model:
"""The class that helps build visu... |
visualizer.py | from subprocess import call
from xml.dom import minidom
import xml.etree.ElementTree as ET
import ast
import LCD_1in44
import LCD_1in3
import LCD_Config
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
from PIL import ImageColor
import RPi.GPIO as GPIO
import time
import random
import webcolors... |
mail_server.py | #!/usr/bin/python3
import re
import sqlite3
import configparser
import asyncore
import mailparser
import base64
import threading
import time
import sys
import json
from urllib.parse import urlparse
from http.server import BaseHTTPRequestHandler, HTTPServer
from socketserver import ThreadingMixIn
from datetime import da... |
analysis.py | from typing import List, Tuple
import multiprocessing
import os
import posixpath
import queue
import threading
import cv2
import dask as da
import h5py as hf
import numpy as np
import pint
from structure import ureg, Q_
from structure.analysis.statistics import Statistics, compute_statistics
from structure.grouped.fpw... |
test8.py | import multiprocessing
import time
def worker(s, i):
s.acquire()
print(multiprocessing.current_process().name + "acquire");
time.sleep(i)
print(multiprocessing.current_process().name + "release\n");
s.release()
if __name__ == "__main__":
s = multiprocessing.Semaphore(2)
for i in range(5)... |
dbus_digitalinputs.py | #!/usr/bin/python -u
import sys, os
import signal
from threading import Thread
from select import select, epoll, EPOLLPRI
from functools import partial
from collections import namedtuple
from argparse import ArgumentParser
import traceback
sys.path.insert(1, os.path.join(os.path.dirname(__file__), 'ext', 'velib_python... |
player.py | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... |
server.py | from concurrent import futures
import time
import logging
from activeNodes import activeNodes
from threading import Thread
import sys
import grpc
from NodePing import Heartbeat
from FileOperations import FileService
sys.path.append('./Gen')
import heartbeat_pb2
import heartbeat_pb2_grpc
import fileservice_pb2_grpc as f... |
kinect2grasp_python2.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author : Hongzhuo Liang
# E-mail : liang@informatik.uni-hamburg.de
# Description:
# Date : 05/08/2018 6:04 PM
# File Name : kinect2grasp_python2.py
# Note: this file is written in Python2
import torch
import rospy
from sensor_msgs.msg import PointCloud2
fr... |
subprocess2.py | # coding=utf8
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Collection of subprocess wrapper functions.
In theory you shouldn't need anything else in subprocess, or this module failed.
"""
import... |
bm_threading.py | #!/usr/bin/env python
"""Some simple microbenchmarks for Python's threading support.
Current microbenchmarks:
- *_count: count down from a given large number. Example used by David
Beazley in his talk on the GIL (http://blip.tv/file/2232410). The
iterative version is named iterative_... |
WaagentLib.py | #!/usr/bin/env python
#
# Azure Linux Agent
#
# Copyright 2015 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... |
sensor.py | import datetime
import json
import logging
import queue
import random
import threading
import time
from abc import ABC, abstractmethod
from lib.logger import logger
from lib.sds011 import SDS011
class Measurement:
def toJSON(self):
return json.dumps(self, default=lambda o: o.__dict__,
... |
GUI.py | import matplotlib
matplotlib.use('TkAgg')
from numpy import arange, sin, pi
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
# implement the default mpl key bindings
from matplotlib.backend_bases import key_press_handler
from matplotlib.figure import Figure
from tkinter ... |
utils.py | try:
from Crypto import Random
from Crypto.Cipher import AES
except:
from Cryptodome import Random
from Cryptodome.Cipher import AES
from colorama import init, Fore, Back, Style
from datetime import datetime
from selenium.webdriver import Chrome, ChromeOptions
from selenium.webdriver.common.desired_capa... |
test_wrapper.py | import os
import sys
from pathlib import Path
from tempfile import NamedTemporaryFile, TemporaryDirectory
from threading import Thread
from time import sleep
from finorch.wrapper.wrapper import run
from tests.unit.local.test_local_client import SCRIPT
from finorch.utils.cd import cd
def test_run():
... |
test_server.py | # -*- coding: utf-8 -*-
"""Tests for pyss3.server."""
import pyss3.server as s
import threading
import argparse
import socket
import pytest
import pyss3
import json
import sys
from os import path
from pyss3 import SS3
from pyss3.util import Dataset, Print
HTTP_REQUEST = "%s %s HTTP/1.1\r\nContent-Length: %d\r\n\r\n%s... |
notify.py | import os
import threading
import time
class Notify():
def __init__(self, context, for_test=False):
if for_test:
context.notify = self.fake_notify
self.messages = []
else:
context.notify = self.notify
self.last_notify = time.time()
threadi... |
dupe_image_lib.py | import collections
import copy
import datetime
import imagehash
import json
import traceback
import multiprocessing as mp
from pathlib import Path
from PIL import Image
class ImageStruct:
def __init__(self, directory: Path, allowed_cpu_cores: int, pyqt_signals: dict):
"""
An ImageS... |
multiprocessing_xrh.py |
from multiprocessing import *
import os, time, random
# 子进程要执行的代码
def run_proc(name):
print('Run child process %s (%s)...' % (name, os.getpid()))
def long_time_task(name):
print('Run task %s (%s)...' % (name, os.getpid()))
start = time.time()
time.sleep(random.random() * 3)
end = time.time()
... |
test_wikification.py | # # %%
# import sys
# print(sys.path)
# # %%
# import os
# import datetime
# import numpy as np
# import multiprocessing
# from wikification import _sum_page_rank, _recompute_on_anchor_text, _extraxt_concepts_from_wikires, _call_wikifier, _sum_classic_page_rank
# # %%
# import os
# import datetime
# corpuspath = "../..... |
player.py | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... |
core.py | # -*- coding: utf-8 -*-
import traceback
import json
import requests
from string import capwords
from .request import threading, Request
from . import source_utils
from .source_utils import tools
from .utils import beautifulSoup, encode, decode, now, time, clock_time_ms, safe_list_get, get_caller_name, replace_text_w... |
collect_training_data.py | __author__ = 'yxt'
import numpy as np
import cv2
import pygame
from pygame.locals import *
import time
import os
import threading
import socketserver
class ControlHandler(socketserver.BaseRequestHandler):
def handle(self):
print('New connection for Control:', self.client_address)
... |
tracker.py | """
from https://github.com/dmlc/dmlc-core/blob/master/tracker/dmlc_tracker/tracker.py
Tracker script for DMLC
Implements the tracker control protocol
- start dmlc jobs
- start ps scheduler and rabit tracker
- help nodes to establish links with each other
Tianqi Chen
"""
from __future__ import absolute_import
impo... |
data_plane_test.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
mmalobj.py | # vim: set et sw=4 sts=4 fileencoding=utf-8:
#
# Python header conversion
# Copyright (c) 2013-2017 Dave Jones <dave@waveform.org.uk>
#
# Original headers
# Copyright (c) 2012, Broadcom Europe Ltd
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted... |
uart_provider.py | import os
import re
import time
import json
import struct
import datetime
import threading
from ..base import OpenDeviceBase
from ..decorator import with_device_message
from ...framework.utils import (helper, resource)
from . import dmu_helper
from .configuration_field import CONFIGURATION_FIELD_DEFINES_SINGLETON
from ... |
main.py | from subprocess import Popen, PIPE
from threading import Thread
from queue import Queue, Empty
import atexit
import os
import sys
agent_processes = [None, None]
t = None
q = None
def cleanup_process():
global agent_processes
for proc in agent_processes:
if proc is not None:
proc.kill()
def... |
count_down_latch_test.py | import threading
from time import sleep
from tests.base import SingleMemberTestCase
from tests.util import random_string
from hazelcast import six
from hazelcast.six.moves import range
class CountDownLatchTest(SingleMemberTestCase):
def setUp(self):
self.latch = self.client.get_count_down_latch(random_st... |
ionosphere.py | from __future__ import division
import logging
import os
from os import kill, getpid, listdir
from os.path import join, isfile
from sys import version_info
# @modified 20191115 - Branch #3262: py3
# try:
# from Queue import Empty
# except:
# from queue import Empty
from time import time, sleep
from threading ... |
asyncorereactor.py | # Copyright 2013-2016 DataStax, 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 writi... |
run_nvmf.py | #!/usr/bin/env python3
import os
import re
import sys
import json
import paramiko
import zipfile
import threading
import subprocess
import itertools
import time
import uuid
import rpc
import rpc.client
import pandas as pd
from collections import OrderedDict
from common import *
class Server:
def __init__(self, n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.