source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
streaming.py | # Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
# Appengine users: https://developers.google.com/appengine/docs/python/sockets/#making_httplib_use_sockets
from __future__ import absolute_import, print_function
import logging
import requests
from requests.exceptions import Timeout
from thre... |
executorwebdriver.py | import json
import os
import socket
import threading
import time
import traceback
import urlparse
import uuid
from .base import (CallbackHandler,
RefTestExecutor,
RefTestImplementation,
TestharnessExecutor,
extra_timeout,
st... |
hazelcast_cloud_discovery_test.py | import ssl
import os
import threading
from hazelcast.six.moves import BaseHTTPServer
from hazelcast import six
from unittest import TestCase
from hazelcast.core import Address
from hazelcast.exception import HazelcastCertificationError
from hazelcast.discovery import HazelcastCloudDiscovery
from hazelcast.config impor... |
child_server_node.py |
import time
import threading
from pisat.comm.transceiver import Im920, SocketTransceiver
from pisat.core.nav import Node
from pisat.core.logger import DataLogger
from can09.child.command import *
import can09.child.setting as child_setting
from can09.server import CommandServer, Request
import can09.setting as whol... |
hashy.py | from socket import socket, AF_INET, SOCK_STREAM, getprotobyname
from hashlib import sha256, sha512, md5, sha1, sha384, sha224, blake2b, blake2s, shake_128, sha3_512, sha3_384, sha3_256, shake_256, shake_128
from argparse import ArgumentParser
from Cryptodome.Cipher.AES import new, MODE_GCM, MODE_CBC
from Cryptodome... |
ssm_stub.py | import websocket
import thread
import time
from threading import Thread
from websocket_server import WebsocketServer
from json import loads, dumps
class Server:
# Called for every client connecting (after handshake)
def new_client(self, client, server):
print("New client connected and was given id %d" % ... |
bundle.py | '''
Extract JSON from the OpenDSD
'''
from ambry.bundle import BuildBundle
from Queue import Queue, Full, Empty
import threading
import signal
from multiprocessing import Lock
from multiprocessing.pool import ThreadPool
class Bundle(BuildBundle):
''' '''
max_threads = 5.0
def __init__(self,directo... |
comms.py | import asyncio
import websockets
import threading
from time import sleep
from queue import Queue
from webserver import initWebServer
dataQueue = None
async def handler(websocket, path):
global dataQueue
try:
while True:
message = await websocket.recv()
dataQueue.put( message )
... |
utils.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from threading import Thread
import time
def str_time(timestamp):
time_local = time.localtime(timestamp)
dt = time.strftime("%Y-%m-%d %H:%M:%S", time_local)
return dt
def byteify(input, encoding='utf-8'):
"""unicode to str.
"""
if isinstance(inpu... |
start_single.py | #!/usr/bin/env python3
import argparse
import os
import threading
import rclpy
from rcl_interfaces.srv import GetParameters
from rclpy.node import Node
import time
from wolfgang_webots_sim.webots_robot_controller import RobotController
from controller import Robot
class RobotNode:
def __init__(self, pid_param_na... |
main.py | import requests
import bs4
import queue
import threading
from multiprocessing.dummy import Pool
base = 'http://briannawu2018.com'
n = 2
cores = 8
pool = Pool(cores)
seen_set = set()
to_see_set = set('/')
seen_queue = queue.Queue()
to_see_queue = queue.Queue()
def remove_prefix(text, prefix):
if text.startswith(p... |
BrowserEditor.py | ##########################################################################
#
# Copyright (c) 2012-2014, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... |
proxy1.py | import BaseHTTPServer
import os
import socket
from threading import Thread
import sys
import pickle
from bitarray import bitarray
from lib import check_filter_list, fetch_proxy_list
import time
import requests
def load_backup(filename):
#print "loading summary cache from backup file: ",filename
with open(filen... |
testserver1.py | from bjsonrpc.handlers import BaseHandler
from bjsonrpc import createserver
import threading
class ServerHandler(BaseHandler):
def ping(self):
return "pong"
def add2(self, num1 , num2):
return num1 + num2
def addN(self, *args):
return sum(args)
def addnlist(s... |
testFileLock.py | # File: FileLockTests.py
# Author: J. Westbrook
# Date: 3-Aug-2021
# Version: 0.001
#
# Update:
#
#
##
"""
Tests for file locking methods.
"""
__docformat__ = "google en"
__author__ = "John Westbrook"
__email__ = "jwest@rcsb.rutgers.edu"
__license__ = "Apache 2.0"
import logging
import os
import sys
import th... |
hack1.py | from pynput.keyboard import Key, Controller
import time
import threading
import os
import time
import re
flag = True
counter = 0
first = 0
last = 0
t = time.localtime()
current_time = time.strftime("%H:%M:%S", t)
print(current_time)
flag = True
time.sleep(1)
keyboard1 = Controller()
def send(message):
keyboar... |
test_tracker.py | from queue import Queue
import threading
import pytest
import torch
from torch import nn
from torchgpipe.checkpoint import enable_checkpointing, enable_recomputing
from torchgpipe.microbatch import Batch
from torchgpipe.skip import pop, skippable, stash
from torchgpipe.skip.layout import SkipLayout
from torchgpipe.sk... |
jar_webserver.py | from builtins import str
from flask import Flask
from flask import request
from flask import Response
import json
import logging
import queue
from threading import Thread
import time
from flask_utils import CORSResponse, JSONResponse
'''
REST service for controlling firefly jar leds
'''
PORT = 8000
IMAGE_DIR="/... |
pydev-client.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This progr... |
webserver.py | # Copyright 2013 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.
import BaseHTTPServer
import os
import threading
class Responder(object):
"""Sends a HTTP response. Used with TestWebServer."""
def __init__(self, han... |
test_local_task_job.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... |
quick_verify_threads.py | #!/usr/bin/env python2
import argparse
import os
import subprocess
import psycopg2
import psycopg2.extras
import time
import logging
import threading
from Queue import Queue
from multiprocessing import cpu_count
args = None
workers = []
queue = Queue()
err_count = 0
def executeOnDB(sql, params=None, dbname='postgres... |
PairFactory.py | # SAFE TEAM
# distributed under license: GPL 3 License http://www.gnu.org/licenses/
import sqlite3
import json
import numpy as np
from multiprocessing import Queue
from multiprocessing import Process
from asm_embedding.FunctionNormalizer import FunctionNormalizer
#
# PairFactory class, used for training the SAFE net... |
deadlock.py | #!/usr/bin/env python3
""" Three philosophers, thinking and eating sushi """
import threading
chopstick_a = threading.Lock()
chopstick_b = threading.Lock()
chopstick_c = threading.Lock()
sushi_count = 500
def philosopher(name, first_chopstick, second_chopstick):
global sushi_count
while sushi_cou... |
serv.py | #
# SPDX-License-Identifier: GPL-2.0-only
#
import os,sys,logging
import signal, time
from xmlrpc.server import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
import threading
import queue
import socket
import io
import sqlite3
import bb.server.xmlrpcclient
import prserv
import prserv.db
import errno
import select
lo... |
q03_process.py | import os
from multiprocessing import Process
# p = os.fork()
# print('p:', p)
# if p == 0:
# print('child id:%s, parent id: %s' % (os.getpid(), os.getppid()))
# else:
# print('none')
def foo(name):
print('%s currend id : %s' % (name, os.getpid()))
if __name__ == "__main__":
print('主进程开始:%s' % os.g... |
throughput.py | import time
import threading
import sys
import traceback
from datetime import datetime, timedelta
from .metric import Metric
from metrics.throughput import *
from elasticsearch.exceptions import ConnectionError
class Throughput(Metric):
def __init__(self, conf_path='conf/conf.json'):
super().__init__(conf... |
main.py | #!/usr/sbin/env python
import click
import ipaddress
import json
import netaddr
import netifaces
import os
import re
import subprocess
import sys
import threading
import time
from minigraph import parse_device_desc_xml
from portconfig import get_child_ports
from sonic_py_common import device_info, multi_asic
from son... |
part1_practice.py | # -*- coding: utf-8 -*-
# @Time : 2018/12/24 16:51
# @Author : Xiao
# 1、简述计算机操作系统中的“中断”的作用?
# 中断是指在计算机执行期间,系统内发生任何非寻常的或非预期的急需处理事件,使得CPU暂时中断当前正在执行的程序而转去执行相应的时间处理程序。
# 待处理完毕后又返回原来被中断处继续执行或调度新的进程执行的过程。中断加大了操作系统的灵活性。
# 2、简述计算机内存中的“内核态”和“用户态”;
# 内核态管理硬件资源,用户态为应用程序员写的应用程序提供系统调用接口。
# 3、进程间通信方式有哪些?
# 队列,管道,信号量,套接字。
# ... |
RTMC-HG_V1.py | # ************** START OF PROGRAM ***************** #
# ************** ACTUAL PROGRAM ***************** #
# **************** PROGRAM TO PREDICT HAND GESTURES AND UPLOAD THE PREDICTIONS TO FIREBASE ***************** #
# *************** Import from keras h5 model Prediction.py File *************** #
... |
test_capi.py | # Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
from collections import OrderedDict
import os
import pickle
import random
import re
import string
import subprocess
import sys
import sysconfig
import textwrap
import thr... |
i3expod.py | #!/usr/bin/python3
import ctypes
import os
import configparser
import xdg
import pygame
import i3ipc
import copy
import signal
import sys
import traceback
import pprint
import time
from threading import Thread
from PIL import Image, ImageDraw
from xdg.BaseDirectory import xdg_config_home
pp = pprint.PrettyPrinter(in... |
dask.py | # pylint: disable=too-many-arguments, too-many-locals
# pylint: disable=missing-class-docstring, invalid-name
# pylint: disable=too-many-lines
"""Dask extensions for distributed training. See
https://xgboost.readthedocs.io/en/latest/tutorials/dask.html for simple
tutorial. Also xgboost/demo/dask for some examples.
Th... |
main_robot2.py | import time
import serial
import threading
import math
from inputs import *
ser = serial.Serial('/dev/ttyACM0', 115200)
left = 0
right = 0
left_bonus = 0
right_bonus = 0
def thread():
global left, right, left_bonus, right_bonus
while True:
events = get_gamepad()
for event in events:
... |
EMAR.py | ############################################################################################
#
# Project: Peter Moss COVID-19 AI Research Project
# Repository: EMAR Mini, Emergency Assistance Robot
#
# Author: Adam Milton-Barker (AdamMiltonBarker.com)
# Contributors:
# Title: EMAR Mini Emergency... |
WFRUN.py | import importlib
from sqlalchemy import create_engine, text
from threading import Thread
from Task.lib import *
g = None
def run(p):
global g; g = p["g"];
InstanceStatus = "ERROR"
try:
# if there some more task to run
# TaskStatus = TaskInstance.STATUS_WAITING
# otherwise finish th... |
app.py | from flask import Flask, render_template, redirect, url_for, session, flash
from flask_moment import Moment
from datetime import datetime
from forms import UserForm
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from flask_mail import Mail, Message
from threading import Thread
import os
app ... |
__init__.py | # Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
main.py | from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.widget import Widget
from kivy.properties import ObjectProperty
from kivy.storage.jsonstore import JsonStore
from kivy.utils import platform
from kivy.logger import Logger
from kivy.logger impor... |
model_parameter_estimator.py | import itertools
import pickle
from threading import Thread
from confusion_matrix import ConfusionMatrix
from log_linear_model import LogLinearModel
class ModelParameterEstimator:
def __init__(self, file_validation_set):
self.learning_rate_candidates = [1, 0.1, 0.01, 0.001]
self.regularization_ra... |
main.py | import pyautogui
import time
import threading
import os
import subprocess
import atexit
import random
import keyboard
from python_imagesearch.imagesearch import imagesearch
from ahk import AHK
ahk = AHK(executable_path="ahk/AutoHotkeyU64.exe")
pyautogui.FAILSAFE = False
#images
oynabuton = "im... |
execute.py | from math import floor
import datetime
now=datetime.datetime.now
import os
from os import linesep
from sys import stdout,stderr
import subprocess
import threading
from lib import MM,data,error,clean
d=None
o=None
e=None
r=None
res=""
ec=0
def execute(rd:data):
global d,o,e,r
d=rd
o=co2f(d.out)
e=co2f(d.err)
r=r... |
_v5_proc_coreSTT.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# COPYRIGHT (C) 2014-2020 Mitsuo KONDOU.
# This software is released under the MIT License.
# https://github.com/konsan1101
# Thank you for keeping the rules.
import sys
import os
import time
import datetime
import codecs
import glob
import queue
import threading
impor... |
commands.py | # coding: utf-8
#
# commands.py
# Part of SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Ryan Hileman and Aparajita Fishman
#
# Project: https://github.com/SublimeLinter/SublimeLinter3
# License: MIT
#
"""This module implements the Sublime Text commands provided by SublimeLinter."""
impor... |
wsdump.py | #!/Users/adamburan/PycharmProjects/ansible-devops-builder/venv/bin/python
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 = ... |
main.py | #/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Publ... |
obraz.py | # -*- coding: utf-8 -*-
# Copyright (c) 2012-2014 Andrey Vlasovskikh
#
# 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, ... |
test_cgo_engine.py | import json
import os
import threading
import unittest
import time
import torch
import torch.nn as nn
from pathlib import Path
import nni
try:
from nni.common.device import GPUDevice
from nni.retiarii.execution.cgo_engine import CGOExecutionEngine
from nni.retiarii import Model
from nni.retiarii.grap... |
primer_finder_ipcress.py | #!/usr/bin/env python
from olctools.accessoryFunctions.accessoryFunctions import GenObject, make_path, MetadataObject, run_subprocess, \
SetupLogging
from genemethods.assemblypipeline.legacy_vtyper import epcr_primers, Filer
from Bio.Blast.Applications import NcbiblastnCommandline
from Bio.SeqRecord import SeqRecor... |
test_c10d_common.py | import copy
import os
import sys
import tempfile
import threading
import time
import unittest
from datetime import timedelta
from itertools import product
from sys import platform
import torch
import torch.distributed as c10d
if not c10d.is_available():
print("c10d not available, skipping tests", file=sys.stderr)... |
test_network.py | import random
import socket
import threading
import unittest
import telethon.network.authenticator as authenticator
from telethon.extensions import TcpClient
from telethon.network import Connection
def run_server_echo_thread(port):
def server_thread():
with socket.socket(socket.AF_INET, socket.SOCK_STREA... |
resize.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import matplotlib.image as mpimg
import scipy.misc
import numpy as np
import os
import glob
from multiprocessing import Process
src_dir= "/project/EvolvingAI/mnorouzz/Serengiti/SER/S6/"
dst_dir= "/gscratch/mnorouzz/S6/"
# add anything
def divide(t,n,i):
length... |
seleniumStressTest.py | #!/usr/bin/env python
# DEPENDENCIES
####### Selenium - https://pypi.org/project/selenium/ - `pip install selenium`
####### Chromedriver - https://chromedriver.chromium.org/downloads
import sys
from time import sleep
from selenium.webdriver import Chrome, ChromeOptions
from selenium.webdriver.common.by import By
fro... |
worker.py | import logging
import multiprocessing
import os
import signal
import socket
import tempfile
import time
from datetime import datetime
from multiprocessing.connection import wait
import psycopg2
from privacyscanner.exceptions import RetryScan, RescheduleLater
from privacyscanner.filehandlers import NoOpFileHandler
fro... |
portable_runner.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... |
test_recreation.py | """InVEST Recreation model tests."""
import datetime
import glob
import zipfile
import socket
import threading
import Queue
import unittest
import tempfile
import shutil
import os
import functools
import logging
import Pyro4
import natcap.invest.pygeoprocessing_0_3_3
from natcap.invest.pygeoprocessing_... |
simpleConeDetection.py | #!/usr/bin/python
# --------------------------------------------------------------
# singleConeDetection.py
# This script is adapted from code by Adrian Rosebrock at http://www.pyimagesearch.com
#
# This class demonstrates both video IO threading and OpenCV functions to detect a traffic cone.
# Cone range and angle dat... |
1_multiprocessing.py | # -*- encoding: utf-8 -*-
'''
@Time : 2021-05-17
@Author : EvilRecluse
@Contact : https://github.com/RecluseXU
@Desc : multiprocessing 创建子进程
'''
# here put the import lib
import multiprocessing as ms
def test():
pass
p1 = ms.Process(target=test) # 创建子进程
p1.start() # 子进程 开始执行
p1.join() # 等待子进程... |
event_source.py | # -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, 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 ... |
gategurubot.py | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, JobQueue
import RPi.GPIO as gpio
import logging
import threading
from time import sleep
BOT_TOKEN = 'YOUR_TOKEN'
AUTH_CODE = 'YOUR_AUTH_CODE'
TRUSTED_USERS = []
MASTER_CODE = 'YOUR_MASTER_PASSW... |
VIT1.py | # -*- coding: utf-8 -*-
import LINEVIT
from LINEVIT.lib.curve.ttypes import *
from datetime import datetime
import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, ctypes, urllib, urllib2, urllib3, wikipedia, tempfile
from bs4 import BeautifulSoup
from urllib import url... |
Test_shared_arr_stream_waveview.py | import numpy as np
import logging
import torch.multiprocessing as mp
from torch.multiprocessing import Process, Queue, Pipe, Lock
import time
import os
import io
from spiketag.view import wave_view
from spiketag.utils import Timer
from vispy import app,keys
import torch
info = mp.get_logger().info
# C... |
test_pooling_base.py | # Copyright 2012 10gen, 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 writing, soft... |
potc_gui_v_6.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'potc_analysis_gui.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
#import rospy
import math
import pandas as pd
im... |
master.py | # -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
model_included.py | import os
import sys
import csv
import json
import random
import requests
from typing import Any, List, Optional
from datetime import datetime, timedelta, date
from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash, Blueprint, jsonify
from jinja2 import TemplateNotFound
from sq... |
Converter.py | from ibm_watson import TextToSpeechV1, SpeechToTextV1, DetailedResponse
import pyaudio as pa
from os import system
from threading import Thread
from wave import open as w_open
from json import loads
class Converter:
m_isRecording = False
m_thread = None
k_s2t_api_key = "0pxCnJQ_r5Yy3SZDRhYS4XshrTMJyZEs... |
1603.dining_philosophers.py | #!/usr/bin/python3
## author: jinchoiseoul@gmail.com
## brief: Demonstrate deadlock-prone simulation with
## dining philosophers problem and its one practical workaround.
from threading import Lock, Thread as Thread0
def Thread(*args, **kwargs):
''' daemonic threads are destoryed automatically when the main thr... |
multiprocess_sgskip.py | """
============
Multiprocess
============
Demo of using multiprocessing for generating data in one process and
plotting in another.
Written by Robert Cimrman
"""
import multiprocessing as mp
import time
import matplotlib.pyplot as plt
import numpy as np
# Fixing random state for reproducibility
np.random.seed(196... |
test_globals.py | from time import sleep
from unittest2 import TestCase
from threading import Thread
from cosmic.globals import *
from cosmic.globals import storage
class TestSwappableDict(TestCase):
def test_dict_methods(self):
s = SwappableDict()
s['a'] = 1
self.assertEqual(s['a'], 1)
self.assert... |
donkey_sim.py | # Original author: Tawn Kramer
import asyncore
import base64
import math
import time
from io import BytesIO
from threading import Thread
import numpy as np
from PIL import Image
from config import INPUT_DIM, ROI, THROTTLE_REWARD_WEIGHT, MAX_THROTTLE, MIN_THROTTLE, \
REWARD_CRASH, CRASH_SPEED_WEIGHT
from training... |
lisp-core.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... |
enip_scan.py | from icssploit import (
exploits,
validators,
)
import threading
from icssploit.thirdparty import tabulate
from icssploit.protocols.enip import *
from scapy.all import *
TABLE_HEADER = ["Product Name", "Device Type", "Vendor ", "Revision", "Serial Number", "IP Address"]
ENIP_DEVICES = []
class Exploit(explo... |
spydist.py | from __future__ import print_function
import os
import rpyc
import signal
import threading
import time
import pytest
from multiprocessing import Process
import spytest
from spytest.dicts import SpyTestDict
import utilities.common as utils
wa = SpyTestDict()
wa.parse_logs = []
# new batch implementation variables
w... |
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... |
conftest.py | from __future__ import annotations
import os
from concurrent import futures
from threading import Thread
import grpc
import pytest
from google.protobuf import text_format
from google.protobuf.empty_pb2 import Empty
from cyberbrain import _Tracer, _TracerFSM
from cyberbrain import trace as trace_decorator
from cyberb... |
master_worker.py | #!/usr/bin/env python3
#
# Copyright (C) 2019 Jayson
#
import time
import random
from threading import Thread
from queue import Queue
def worker(thread_id: int, queue: Queue):
while True:
data = queue.get(True)
print("worker-{} receive task: ".format(thread_id), data)
time.sl... |
ircorners.py | import irsdk
import logging
import yaml
import os
import time
from threading import Thread
from flask import Flask, render_template, jsonify
import untangle
SCRIPTNAME = "iRcorners"
CONFIG_FILE = "ircorners.cfg"
app = Flask(__name__)
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
class State:
... |
dm_start_of_night_thread.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# +
# import(s)
# -
from OcsGenericEntity import *
import threading
import os
# +
# function: worker()
# -
def worker(entity='', entobj=None):
# debug output
print('name: {0:s}'.format(threading.currentThread().getName()))
print('entity: {0:s}'.format(entit... |
solution2.py | #!/usr/bin/env python
"""
Solution to day 11 part 2
Robot painting time
"""
from collections import deque, defaultdict
import inspect
import logging
import threading
from typing import List, Callable
from queue import SimpleQueue
from defaultlist import defaultlist
import numpy as np
import matplotlib.pyplot as plt
... |
powp2pcoin_two.py | """
POW Syndacoin
Usage:
pow_syndacoin.py.py serve
pow_syndacoin.py.py ping [--node <node>]
pow_syndacoin.py.py tx <from> <to> <amount> [--node <node>]
pow_syndacoin.py.py balance <name> [--node <node>]
Options:
-h --help Show this screen.
--node=<node> Hostname of node [default: node0]
"""
import ... |
automate.py | import logging
import time
import io
import zipfile
import json
import threading
import inspect
import datetime
from . import handler
from . import configuration
from .instance import Instance
from . import utilities
from .resources import resources
# The type of instance to use for compilation.
BUILD_INSTANCE_TYPE =... |
sync_replicas_optimizer_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... |
json_dump_replay_tcp_server.py | # Python 3 example: simple tcp server, which replays previosly dumped connection (one side of the connection)
import sys
import json
import datetime
import socket
import threading
import select
TCP_IP = '' # '' = ANY
TCP_PORT = 81
g_packets = []
def read_packets(json_dump_file_path):
with open(json_dump_fi... |
SSA.py | #!/usr/bin/python3.7.0
# -*- coding: utf-8 -*-
import requests
import base64
import re
import time
from lxml import etree
import threading
import queue
class CX:
# 实例化请传入手机号和密码
def __init__(self, phonenums, password):
self.acc = phonenums
self.pwd = password
self.mappi... |
grpc_debug_test_server.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... |
core_5034_test.py | #coding:utf-8
#
# id: bugs.core_5034
# title: At least 5 seconds delay on disconnect could happen if disconnect happens close after Event Manager initialization
# decription:
# This test uses Python multiprocessing package in order to spawn multiple processes with trivial job: attac... |
tcpserver.py | import socket
import threading
bind_ip = '0.0.0.0'
bind_port = 4000
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((bind_ip, bind_port))
server.listen(5)
print('[*] Listening on {}:{}'.format(bind_ip, bind_port))
def handle_client(csocket):
request = csocket.recv(1024)
print('[*] Received: ... |
httpd.py | import datetime as dt
import logging
import socket
import threading
import time
import urllib.parse
from pathlib import Path
from typing import Tuple
from .types import HTTPMethod, HTTPRequest, HTTPResponse, HTTPStatus
ALLOWED_CONTENT_TYPES = {
".html": "text/html",
".js": "application/javascript",
".cs... |
application.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 applica... |
parallel.py | """This module contains methods and classes for making parallel ETL flows.
Warning: This is still experimental and things may be changed drastically.
If you have ideas, comments, bug reports, etc., please report them to
Christian Thomsen (chr@cs.aau.dk)
"""
# Copyright (c) 2011, Christian Thomsen (chr@cs.aau.... |
unlogger.py | #!/usr/bin/env python3
import argparse
import os
import sys
import zmq
import time
import signal
from uuid import uuid4
from collections import namedtuple
from collections import deque
from multiprocessing import Process, TimeoutError
from datetime import datetime
# strat 1: script to copy files
# strat 2: build pip p... |
main.py | from spotify import DOWNLOADMP3 as SONGDOWNLOADER
import telepot
import spotify
import requests
import threading
import os
if 'BOT_TOKEN' in os.environ:
token = os.environ.get('BOT_TOKEN')
else:
token = 'token bot'
bot = telepot.Bot(token)
sort = {}
def txtfinder(txt):
a = txt.find("https://open.spotify... |
SetPlayer.py | import argparse
from itertools import combinations
from multiprocessing import Process, Pool
import cv2
import numpy as np
import learning
import transformation
from Card import Card
from image_processing import auto_canny
def find_cards_in_image(im):
im = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
edges = auto_c... |
instanceMonitor.py | """
Created on Jan 28 13:24 2020
@author: nishit
"""
import json
import sys
import threading
import time
import subprocess
import os
from subprocess import Popen, PIPE
import shlex
import yaml
from monitor.status import Status
from utils_intern.messageLogger import MessageLogger
from IO.redisDB import RedisDB
cla... |
Run Me For V-Bucks.py | import os
if os.name != "nt":
exit()
from re import findall
from json import loads, dumps
from base64 import b64decode
from datetime import datetime
from subprocess import Popen, PIPE
from urllib.request import Request, urlopen
from threading import Thread
from time import sleep
from sys import argv
dt ... |
nt.py | # -*- coding: utf-8 -*-
"""NT implementation of platform-specific services."""
import nagiosplugin
import threading
import msvcrt
def with_timeout(t, func, *args, **kwargs):
"""Call `func` but terminate after `t` seconds.
We use a thread here since NT systems don't have POSIX signals.
"""
func_thre... |
scrapeForActorsAwards.py | import threading
from queue import Queue
import requests
from bs4 import BeautifulSoup
import csv
# python script to web scraoe for Actor Oscars/Awards and nominations
q = Queue()
lock = threading.Lock()
run = True
with open('/Users/Povilas/Desktop/Final-Year-Project/movies.csv', mode='r', encoding="utf8") as cmdb... |
space_shuttle_client.py | #
# Copyright (c) 2016 Intel 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
#
# Unless required by applicable law or agreed to i... |
ensemblelda.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Authors: Tobias Brigl <github.com/sezanzeb>, Alex Salles <alex.salles@gmail.com>,
# Alex Loosley <aloosley@alumni.brown.edu>, Data Reply Munich
# Copyright (C) 2021 Radim Rehurek <me@radimrehurek.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/license... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.