source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
CMS_manager.py | #!/usr/bin/python3
from Analizer import Analizer
from IOC import IOC
from threading import Thread, Lock, active_count
import threading
from requests import head
from requests.exceptions import ConnectionError
from re import search
class CMS_manager:
def __init__(self, url_site=None, verbose=False):
# Es... |
mp_fork_bomb.py | import multiprocessing
def foo(conn):
conn.send("123")
# Because "if __name__ == '__main__'" is missing this will not work
# correctly on Windows. However, we should get a RuntimeError rather
# than the Windows equivalent of a fork bomb.
r, w = multiprocessing.Pipe(False)
p = multiprocessing.Process(t... |
manual_performance.py | #!/usr/bin/env python
import angr
import argparse
import sys
import time
import os
import math
import random
import resource
import multiprocessing
from tabulate import tabulate
from os.path import join, dirname, realpath
from progressbar import ProgressBar, Percentage, Bar
test_location = str(join(dirname(realpat... |
views.py | from django.shortcuts import render
from django.views import generic
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
import threading
from Resumes.utils import post_resumes_notify_email, post_articel_notify_email
from .models import UserInfo, Skill, Record, Function, Educatio... |
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
"""
import sys
import os
import socket
import struct
import subprocess
import time
import logging
import random
from threading imp... |
ue_mac.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
"""
import threading
from typing import List
from ryu.controller import ofp_event
from ryu.controller.handler import M... |
monitorConnectors.py | """
Created on Feb 11 10:32 2020
@author: nishit
"""
import threading
import time
from IO.monitorPub import MonitorPub
from utils_intern.messageLogger import MessageLogger
logger = MessageLogger.get_logger_parent(parent="connector")
class MonitorConnectors:
def __init__(self, config):
self.status = {}
... |
conftest.py | import pytest
import time
from context import HGECtx, HGECtxError, EvtsWebhookServer, HGECtxGQLServer, GQLWsClient
import threading
import random
from datetime import datetime
import sys
import os
def pytest_addoption(parser):
parser.addoption(
"--hge-urls",
metavar="HGE_URLS",
help="csv li... |
run_local_test.py | # Author: Zhengying LIU
# Creation date: 20 Sep 2018
"""This script allows participants to run local test of their method within the
downloaded starting kit folder (and avoid using submission quota on CodaLab). To
do this, run:
```
python run_local_test.py -dataset_dir='./AutoDL_sample_data/' -code_dir='./AutoDL_sample... |
conftest.py | # Copyright 2019 Axis Communications AB.
#
# For a full list of individual contributors, please see the commit history.
#
# 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.apac... |
run_experiments_estimation.py | import json
import os
from collections import defaultdict
from multiprocessing import Queue, Process
import numpy as np
from experiment_setups.estimation_experiment_setups import simple_iv_setup, \
heteroskedastic_iv_setup, policy_learning_setup
from utils.hyperparameter_optimization import iterate_placeholder_va... |
runner.py | #!/usr/bin/env python
""" This is an example for what a project looks like
with multiple modules and threads while trying to use best practices.
"""
# Imports
import time
import threading
# local
from anaconda.hello import hello
from anaconda.world import world
# Storage
hello_running = False
world_running = False... |
vmtop.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import division
import curses
import libvirt
import threading
import time
from ovm.lvconnect import LibvirtConnect
from ovm.utils.printer import si_unit
UPDATE_DATA_INTERVAL = 1
REFRESH_INTERVAL = 0.5
SORT_NAME, SORT_CPU, SORT_MEM = 0, 1, 3
class Do... |
task_queue.py | from collections import defaultdict
from enum import Enum
from logging import getLogger
from queue import PriorityQueue
from time import sleep, time
from threading import Thread, Lock
from typing import Callable
logger = getLogger('task_queue')
class Signal(Enum):
"""A special signal to send to a worker queue."""
... |
train_extractive.py | #!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import argparse
import glob
import os
import random
import signal
import time
import torch
from distributed import multi_init
from models import data_loader, model_builder
from models.data_loader import load_dataset
from models.... |
op_util.py | # Copyright 2017-2020 TensorHub, 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 writ... |
conftest.py |
import time
import collections
import threading
import pytest
import pysoem
def pytest_addoption(parser):
parser.addoption('--ifname', action='store')
class PySoemTestEnvironment:
"""Setup a basic pysoem test fixture that is needed for most of tests"""
BECKHOFF_VENDOR_ID = 0x0002
EK1100_PRODUCT_... |
main.py | #!/usr/bin/env python
# wipflag{todo}
from threading import Thread
from game import Game
from bytekeeper import ByteKeeper
from broker import Broker # todo
class Main:
def __init__(self):
print('starting main...\n')
self.running = True
self.bytekeeper = ByteKeeper()
self.game = G... |
ServerDataPrep.py | import numpy as np
import pandas as pd
import spacepy.datamodel as dm
from spacepy import pycdf
import os
import pickleshare as ps
from multiprocessing import Process
db_pathway = '~/Database'
db = ps.PickleShareDB(db_pathway)
def data_in(f_name, LOCATION):
try:
data = dm.fromCDF(f_name).copy()
exce... |
dataloader.py | import numpy as np
import multiprocessing
import queue
from itertools import cycle
def default_collate(batch):
if isinstance(batch[0], np.ndarray):
return np.stack(batch)
if isinstance(batch[0], (int, float)):
return np.array(batch)
if isinstance(batch[0], (list, tuple)):
return tu... |
diff.py | #!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
import argparse
import sys
from typing import (
Any,
Callable,
Dict,
Iterator,
List,
Match,
NoReturn,
Optional,
Pattern,
Set,
Tuple,
Type,
Union,
)
def fail(msg: str) -> NoReturn:
print(msg, file=sys.stderr)
sys... |
dark-v4.py | # -*- coding: utf-8 -*-
import os, sys
print '\x1b[1;33mSudah punya ID dan Password nya?'
print '\x1b[1;32mSilahkan Login '
import os, sys
def wa():
os.system('xdg-open https://api.whatsapp.com/send?phone=6289698096572&text=Assalamualaikum')
def restart():
ngulang = sys.executable
os.execl(ngulang, ngula... |
remote_Server.py | #
# Created on Sat Oct 09 2021
# Author: Owen Yip
# Mail: me@owenyip.com
#
import os, sys
import threading
import numpy as np
import time
import zmq
import json
pwd = os.path.abspath(os.path.abspath(__file__))
father_path = os.path.abspath(os.path.dirname(pwd) + os.path.sep + "..")
sys.path.append(father_path)
class... |
app.py | # serve.py
from flask import Flask, request, render_template, send_from_directory, Blueprint, jsonify, Response
from werkzeug.utils import secure_filename
from werkzeug.datastructures import CombinedMultiDict
import logging,os,subprocess,sys
from script import ClouderizerEval
from functools import wraps
import json
imp... |
pyusb_backend.py | """
mbed CMSIS-DAP debugger
Copyright (c) 2006-2013 ARM Limited
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 a... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from cereal import log
from common.params import Params, put_nonblocking
from common.realtime import sec_since_boot
from selfdrive.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
CAR_VOLTAGE_LOW_PASS_K = 0.091 # LPF gain for 5s tau... |
VideoGuardar.py | import threading
import cv2
def getFrame():
global frame
while True:
frame = video_capture.read()[1]
def face_analyse():
while True:
pass
#do some of the opeartion you want
def realtime():
while True:
cv2.imshow('Video', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
... |
send data to simulated feed with paho-mqtt publish.py | # Import standard python modules
import threading
import time
import os
import sys
# Import paho MQTT client.
import paho.mqtt.client as mqtt
# Define callback functions which will be called when certain events happen.
def on_connect(client, userdata, flags, rc):
# Connected function will be called when the client c... |
client.py | import json
import logging
import socket
import threading
from queue import Queue, Empty
logger = logging.getLogger('logstash_client')
class LogStashClient(object):
"""
Logstash client which helps sending data to logstash service via TCP protocol in json format
"""
_instance = None
def __ini... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from typing import Optional
from cereal import log
from common.params import Params, put_nonblocking
from common.realtime import sec_since_boot
from selfdrive.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
from selfdrive.statsd imp... |
base.py | import logging
import threading
import time
log = logging.getLogger(__name__)
class BaseStrategy:
"""Implements threshold-interval based flow control.
The overall goal is to trap the flow of apps from the
workflow, measure it and redirect it the appropriate executors for
processing.
This is bas... |
core.py | # -*- coding: utf-8 -*-
#
# 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
#... |
workflow_util.py | import csv
import os
import time
import threading
from subprocess import Popen
from typing import Dict
from uuid import uuid1
import pandas as pd
import yaml
from notification_service.client import NotificationClient
from notification_service.base_notification import EventWatcher, BaseEvent
from kafka import KafkaProdu... |
processsynch.py | import threading
import random
import time
import concurrent.futures
import logging
import queue
from random import randint
from time import sleep
import tkinter as tk
import os
import queue
from multiprocessing import Process, Queue, cpu_count
# from tkinter import *
class ToolTip(object):
... |
develop_utils.py | import os
import numpy as np
# from pl_examples import LightningTemplateModel
from pytorch_lightning import seed_everything
from pytorch_lightning.callbacks import ModelCheckpoint
from pytorch_lightning.loggers import TensorBoardLogger, TestTubeLogger
from tests import TEMP_PATH, RANDOM_PORTS, RANDOM_SEEDS
from tests... |
__main__.py | from multiprocessing import Process
from cc_server.commons.configuration import Config
from cc_server.services.log.__main__ import main as log_main
from cc_server.services.master.__main__ import main as master_main
from cc_server.services.web.__main__ import main as web_main
from cc_server.services.files.__main__ impo... |
netview.py | #!/usr/bin/env python
# SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved.
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Author:
# beto (@agsolino)
#
# Description:
# The ... |
UI.py | # coding: utf-8
import sys
from PyQt5 import QtWidgets
from PyQt5 import uic
from PyQt5.QtCore import pyqtSlot
from env.Strategies import *
from run import main as program
from pathlib import Path
import os
import threading
import matplotlib.pyplot as plt
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
class Form(QtWid... |
test_session.py | import os
import threading
import time
import socket
import pytest
import cherrypy
from cherrypy._cpcompat import (
copykeys, json_decode,
HTTPConnection, HTTPSConnection
)
from cherrypy.lib import sessions
from cherrypy.lib import reprconf
from cherrypy.lib.httputil import response_codes
from cherrypy.test i... |
utils.py | from __future__ import print_function, division, absolute_import
import atexit
from collections import deque
from contextlib import contextmanager
from datetime import timedelta
import functools
from hashlib import md5
import inspect
import json
import logging
import multiprocessing
from numbers import Number
import o... |
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... |
test_record.py | import unittest
from unittest.mock import patch, MagicMock
from datetime import timedelta
import json
import os
import threading
import signal
import subprocess
import tempfile
import sys
from osgar.record import Recorder
class Sleeper:
def __init__(self, cfg, bus):
self.e = threading.Event()
def s... |
reaper.py | # Copyright European Organization for Nuclear Research (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
#
# Authors:
# - Vincent Garonne, <vin... |
windowsKeylogger.py | '''
This is the windows version of our simplePythonKeylogger. It records keystrokes using pyHook, stores
them in a file called keylogs.txt and transmits back over ssh or email/cloud.
Exit by: <backspace><delete><backspace><delete>
Keylogs are sent when the keylog file reaches 5MB
'''
from sys import exit as sysExit... |
SoundPulseAudio.py | import os
import re
import struct
import subprocess
import threading
import time
import pyaudio
silence_loop = 0
sample_duration_sec = 0.1
timeout_duration_sec = 0.1
silence_duration_sec = 0
tmp_file = '/tmp/randomame.sound'
running = True
monitor_silence_thread = None
def monitor_silence():
global silence_loop... |
conftest.py | from multiprocessing import Process
from .. import server
import pytest
@pytest.fixture(scope='session', autouse=True)
def server_setup():
instance = server.create_server()
process = Process(target=instance.serve_forever)
process.daemon = True
process.start() |
roomba.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Python 2.7/Python 3.5/3.6 (thanks to pschmitt for adding Python 3 compatibility)
Program to connect to Roomba 980 vacuum cleaner, dcode json, and forward to mqtt
server
Nick Waterton 24th April 2017: V 1.0: Initial Release
Nick Waterton 4th July 2017 V 1.1.1: Fixed... |
test_betfairstream.py | import unittest
import socket
import time
import threading
from unittest import mock
from betfairlightweight.streaming.betfairstream import (
BetfairStream,
HistoricalStream,
HistoricalGeneratorStream,
)
from betfairlightweight.exceptions import SocketError, ListenerError
class BetfairStreamTest(unittest... |
autoreload.py | # Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
#
# Borrowed from Django and adapted for Cyrax.
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights reserved.
#
# Redistri... |
datasets.py | import os
import time
import glob
import math
import random
import shutil
import numpy as np
from tqdm import tqdm
from pathlib import Path
from threading import Thread
import cv2
from PIL import Image, ExifTags
import torch
from torch.utils.data import Dataset
from .helpers.utils import (
xyxy2xywh,
xywh2xy... |
test_ae.py | """Tests for the ae module."""
import logging
import os
import signal
import threading
import time
import pytest
from pydicom import read_file, config as PYD_CONFIG
from pydicom.dataset import Dataset
from pydicom.uid import UID, ImplicitVRLittleEndian
from pynetdicom import (
AE,
build_context,
_config... |
settings_20210906113314.py | """
Django settings for First_Wish project.
Generated by 'django-admin startproject' using Django 3.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathli... |
test_queue.py | # test_queue.py
from collections import deque
from curio import *
import time
import threading
from curio.traps import _read_wait
def test_queue_simple(kernel):
results = []
async def consumer(queue, label):
while True:
item = await queue.get()
if item is None:
... |
path.py | from __future__ import absolute_import, unicode_literals
import logging
import os
import re
import stat
import threading
from mopidy import compat, exceptions
from mopidy.compat import queue, urllib
from mopidy.internal import encoding, xdg
logger = logging.getLogger(__name__)
XDG_DIRS = xdg.get_dirs()
def get_... |
client_runner.py | # Copyright 2016, Google 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 copyright
# notice, this list of conditions and the f... |
train_entry_point.py | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "l... |
process_control.py |
# TODO more comprehensive tests
from __future__ import division
from __future__ import absolute_import # XXX is this necessary?
from wx.lib.agw import pyprogress
import wx
from libtbx import thread_utils
from libtbx import runtime_utils
from libtbx import easy_pickle
from libtbx import easy_run
from libtbx.utils impo... |
main.py | from __future__ import print_function
import argparse
import os
import sys
import torch
import torch.optim as optim
import torch.multiprocessing as mp
import torch.nn as nn
import torch.nn.functional as F
from envs import create_atari_env
from model import ActorCritic
from train import train
from test import test
imp... |
test_multiproc.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
import sys
import ptvsd
from ptvsd.common import messaging
from tes... |
dishes.py | import multiprocessing as mp
def washer(dishes, output):
for dish in dishes:
print('Washing', dish, 'dish')
output.put(dish)
def dryer(input):
while True:
dish = input.get()
print('Drying', dish, 'dish')
input.task_done()
dish_queue = mp.JoinableQueue()
dryer_proc = mp... |
glider_camera.py | import os
import time
import logging
import picamera
from PIL import Image
from datetime import datetime
from threading import Thread
from . import glider_config
LOG = logging.getLogger("glider.%s" % __name__)
class GliderCamera(object):
threads = []
threadAlive = False
def __init__(self,
low_... |
mock-device.py | import argparse
from datetime import datetime
import json
import os
import ssl
import time
import random
import threading
import logging
import asyncio
import paho.mqtt.client as mqtt
from connection import create_jwt, error_str
# To set up the device
# EXPORT "GOOGLE_CLOUD_PROJECT"
# EXPORT "PROJECT_ID"
# EXPORT "DE... |
VideoDisplay.py | import sys
import time
import cv2
import threading
from PyQt5.QtCore import QFile
from PyQt5.QtWidgets import QFileDialog, QMessageBox
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtGui import QImage, QPixmap
# import DisplayUI
# from Camera import Camera
# from multiprocessing import Process
# fro... |
test_os_run.py |
import os
import threading
for i in range(8):
threading.Thread(target=os.system,args=('python test_rabbitmq_consume.py',)).start() |
server.py | # Copyright 2015 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... |
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... |
test_forward.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
dmc.py | import os
import sys
import threading
import time
import timeit
import pprint
from collections import deque
import warnings
import torch
from torch import multiprocessing as mp
from torch import nn
import pickle
import random
from .file_writer import FileWriter
from .models import Model
from .utils import get_batch, ... |
variable_scope_test.py | # Copyright 2015 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... |
rdd.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
convert_imagenet_data_set.py | import os
import numpy as np
import random
import time
from datetime import datetime as dt
import matplotlib.pyplot as plt
from PIL import Image
import math
from pathlib import Path, PurePath
from urllib import request
import urllib.error
import pandas as pd
from ggutils import get_module_logger
import http.client
from... |
autocompaction.py | import unittest
import logger
import random
import time
import json
import datetime
from threading import Thread, Event
from TestInput import TestInputSingleton
from basetestcase import BaseTestCase
from membase.api.rest_client import RestConnection
from membase.helper.bucket_helper import BucketOperationHelper
from re... |
step_2_collision_mesh.py | import os
import subprocess
import argparse
import threading
NUM_THREADS = 32
parser = argparse.ArgumentParser('gen all vhacd')
parser.add_argument('--object_name', dest='object_name')
parser.add_argument('--input_dir', dest='input_dir')
parser.add_argument('--output_dir', dest='output_dir')
parser.add_argument('--spl... |
app.py | import flask
import json
import queue
import threading
from jira.issues import issue_event
from jira.sprints import sprint_event, scheduler
app = flask.Flask(__name__)
q = queue.Queue()
def handle_webhook_from_q():
while True:
data = q.get()
if data == 'shutdown':
break
issue ... |
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... |
mod1.py | import requests
from requests import Session
from requests.exceptions import HTTPError
try:
from urllib.parse import urlencode, quote
except:
from urllib import urlencode, quote
import json
import math
from random import uniform
import time
from collections import OrderedDict
from sseclient import... |
main.py | from tkinter import *
from tkinter import messagebox
from tkinter.font import Font
from tkinter import filedialog
from ytbdownloader import *
from threading import Thread
def choise_path():
global savelocal
savelocal = str(filedialog.askdirectory())
label_saveWhere.config(text=savelocal[savelocal.rfind('/... |
ProxyServer.py | __author__ = 'n3k'
import SocketServer
import time
import socket
from select import select
from HttpData import HttpRequest, HttpResponse, HttpDataException
from Logger import Logger
from ProxyModeTestController import TestProxyModeController
from TestController import TestControllerException
from Configuration import... |
C2Server.py | #!/usr/bin/env python3
import os, sys, datetime, time, base64, logging, signal, re, ssl, traceback, threading
from urllib.request import urlopen, Request
from urllib.error import HTTPError, URLError
from Implant import Implant
from Tasks import newTask
from Core import decrypt, encrypt, default_response, decrypt_bytes... |
test1.py | #!/usr/bin/python
from __future__ import absolute_import, print_function, unicode_literals
from optparse import OptionParser, make_option
import dbus
import time
import dbus.mainloop.glib
import bleAdapter
try:
from gi.repository import GObject
except ImportError:
import gobject as GObject
import testutils
import... |
activity_indicator.py | from itertools import cycle
from shutil import get_terminal_size
from threading import Thread
from time import sleep
class ActivityIndicator:
"""NOTE: Don't put anything to stdout while this indicator is active."""
def __init__(self, message: str):
self.message = message
self._thread = Threa... |
output_devices.py | # GPIO Zero: a library for controlling the Raspberry Pi's GPIO pins
# Copyright (c) 2016-2019 Andrew Scheller <github@loowis.durge.org>
# Copyright (c) 2015-2019 Dave Jones <dave@waveform.org.uk>
# Copyright (c) 2015-2019 Ben Nuttall <ben@bennuttall.com>
# Copyright (c) 2019 tuftii <3215045+tuftii@users.noreply.github.... |
sender.py | #!/usr/bin/python
# Testing send mavlink message
from __future__ import print_function
from threading import Thread
from time import sleep
import pymavlink.mavutil as mavutil
import sys
import time
UDP = "192.168.192.101:14550" # The IP and port of QGroundcontrol. It can't be a broadcast IP.
SOURCE_SYSTEM_ID = 99 #... |
async_pool_executor.py | import atexit
import asyncio
import threading
import time
import traceback
from threading import Thread
import nb_log # noqa
# if os.name == 'posix':
# import uvloop
#
# asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) # 打猴子补丁最好放在代码顶层,否则很大机会出问题。
"""
# 也可以采用 janus 的 线程安全的queue方式来实现异步池,此queue性能和本模块实现的生... |
hub.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import copy
import os
import select
import socket
import threading
import time
import uuid
import warnings
from ..extern.six.moves import queue,... |
driveWatch.py | from __future__ import print_function
import httplib2
import os
import time
import webbrowser
import pytz
import json
import threading
import tempfile
import subprocess
import sys
import logging
import logging.handlers
from datetime import datetime, timedelta
from dateutil.parser import parse
from apiclient import dis... |
PyV8.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, re
import logging
import collections
is_py3k = sys.version_info[0] > 2
if is_py3k:
import _thread as thread
from io import StringIO
str = str
raw_input = input
else:
import _thread
try:
from io import StringIO
except ImportErr... |
helper.py | import asyncio
import functools
import json
import math
import os
import random
import re
import sys
import threading
import time
import uuid
import warnings
from argparse import ArgumentParser, Namespace
from datetime import datetime
from itertools import islice
from types import SimpleNamespace
from typing import (
... |
minimizer.py | # Copyright 2019 Google LLC
#
# 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, ... |
sync.py | #
# Copyright (C) 2008 The Android Open Source Project
#
# 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 la... |
compu_racer_core.py | #!/usr/bin/env python3
"""
The CompuRacer class is the heart of the application that manages requests, batches, storage and sending/receiving.
"""
# --- All imports --- #
import copy
import os
import queue
import signal
import threading
import time
import urllib
from enum import Enum
from functools import partial
from... |
test_has_collection.py | import pdb
import pytest
import logging
import itertools
import threading
import time
from multiprocessing import Process
from utils import *
from constants import *
uid = "has_collection"
class TestHasCollection:
"""
******************************************************************
The following case... |
test_threading.py | """
Tests dla the threading module.
"""
zaimportuj test.support
z test.support zaimportuj verbose, strip_python_stderr, import_module, cpython_only
z test.support.script_helper zaimportuj assert_python_ok, assert_python_failure
zaimportuj random
zaimportuj re
zaimportuj sys
_thread = import_module('_thread')
threadin... |
HARS_Server.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# HTTP ASYNCHRONE REVERSE SHELL
# Version : 0.1 POC
# Git : https://github.com/onSec-fr
import BaseHTTPServer, SimpleHTTPServer
import ssl
import os
import base64
import threading
import sys
import random
# Config
PORT = 443
CERT_FILE = '../server.pem'
class MyHandler(BaseH... |
client.py | #! /usr/bin/env python3
import json
import re
import socket
import sys
import threading
import time
import tkinter as tk
from datetime import datetime
IRCRE = ('^(?::(\S+?)(?:!(\S+?))?(?:@(\S+?))? )?' # Nick!User@Host
+ '(\S+)(?: (?!:)(.+?))?(?: :(.+))?$') # CMD Params Params :Message
class IRC(object):
def conne... |
probeSniffer.py | #!/usr/bin/env python3
# -.- coding: utf-8 -.-
import os
import time
import sys
sys.path.append('/home/bayscideaswaimea/.local/bin/scapy')
sys.path.append('/home/bayscideaswaimea/.local/lib/python3.5/site-packages')
print(sys.path)
import sqlite3
import threading
import logging
logging.getLogger("scapy.runtime").setLe... |
example_userdata_stream_new_style.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# File: example_userdata_stream_new_style.py
#
# Part of ‘UNICORN Binance WebSocket API’
# Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api
# Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api
# PyPI:... |
MockServer.py | import http.server
from threading import Thread, Barrier
from functools import partial
class _WebMockServer(http.server.SimpleHTTPRequestHandler):
def log_message(self, format, *args):
pass # avoid logging
def do_GET(self):
self.send_response(200)
self.send_header("Content-type", "text... |
validation.py | # Copyright (c) 2019 Graphcore 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/LICENSE-2.0
#
# Unless required by applicable l... |
project_files_monitor_test.py | # Copyright (c) 2019-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import socket
import tempfile
import threading
import unittest
from unittest.mock import MagicMock, patch
from .. import language_server_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.