source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
process_ticker.py | from multiprocessing import Process, Array, Value, Manager
from time import perf_counter
from os import nice
# TODO:
# set the process priority
# get the process ID
class TickerProcess:
def __init__(self,
freq=100,
name='ticker',
# args = None
... |
main.py | import os
import time
import config
import redis
import socket
import signal
import logging
from threading import Thread
from addict import Dict
from scheduler import HippoScheduler
from tasks import HippoTask
from queues import HippoQueue
from pymesos import MesosSchedulerDriver
from kazoo.client import KazooClient
fr... |
test_odo_in_video_out.py | import communication.socket_comm as sc
import socket
import threading
from multiprocessing import Process
from video.frame_grabber import FrameGrabber
import time
def odo_in(odo_port=8000):
client = sc.Socket()
connected = False
while not connected:
try:
client.connect(socket.gethostna... |
costream.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module wraps the costream process.
Copyright (c) 2020 Mathias A. Seidler, S-Fifteen Instruments Pte. Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
... |
utilities.py | import logging
import threading
import time
from pyalpm import vercmp
from subprocess import run, DEVNULL
from typing import Tuple, Sequence
import regex
from aurman.aur_utilities import get_aur_info
from aurman.coloring import Colors, aurman_error, aurman_question
from aurman.own_exceptions import InvalidInput
def... |
libevreactor.py | # Copyright DataStax, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... |
main.py | import PySimpleGUI as sg
import threading
import numpy as np
import io
import time
from PIL import Image
loading_layout = [
[
sg.Image("images/loading.png")
],
[
sg.Text("Loading Theodore...")
]
]
results = [None, None]
def load_model(window, results):
from chatbot_model import ch... |
program.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... |
admin.py | import threading
from collections import OrderedDict
from dnutils import threads, out, edict
from dnutils.threads import current_thread, sleep, ThreadInterrupt, _MyDummyThread
import pyrap
from pyrap import session
from pyrap.engine import PushService
from pyrap.layout import RowLayout, ColumnLayout
from pyrap.sessio... |
cozmomock.py | import cozmo
from cozmo.util import degrees, radians, distance_mm, speed_mmps, Position, Pose, Rotation, pose_z_angle, rotation_z_angle
import time
import threading
import math
import quaternion
import json
class CozmoBot:
def __init__(self, aruco):
self._wsClient = None
self._dataPubThread = None
# Empty objec... |
views.py | from django.shortcuts import render
import paho.mqtt.client as mqtt
from .models import *
import datetime
from django.utils import timezone
from threading import Thread
def on_connect(client, userdata, flags, rc):
print("Connected with result code " + str(rc))
client.subscribe("Node/#")
def on_message(clien... |
test_compilelock.py | import multiprocessing
import os
import sys
import tempfile
import threading
import time
import filelock
import pytest
from aesara.compile.compilelock import force_unlock, local_mem, lock_ctx
def test_compilelock_errors():
with tempfile.TemporaryDirectory() as dir:
with pytest.raises(ValueError):
... |
8dizer.py | from pydub import AudioSegment
from pydub.playback import play
from pydub import effects
from pydub import utils
import pydub.scipy_effects
import sys, getopt, math
import threading
import time
import multiprocessing
#AudioSegment.converter = "C:\\Program Files (x86)\\ffmpeg\\bin"
def loadfile(inp... |
submitty_router.py | import socket
import sys
import csv
import traceback
import queue
import errno
import json
from time import sleep
import os
import datetime
import random
from datetime import timedelta
import threading
import time
class submitty_router():
'''
A constructor for the standard router, set seed to a positive integer t... |
getpid.py | #-------------------------------------------------------------------------------
# Name: module2
# Purpose:
#
# Author: Rajesh
#
# Created: 28-12-2019
# Copyright: (c) Rajesh 2019
# Licence: <your licence>
#-------------------------------------------------------------------------------
#Progrom fr... |
data_monitor.py | import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from multiprocessing import Process, Queue, TimeoutError
from multiprocessing.connection import Connection
from numpy import ndim, ndarray
from queue import Empty
plt.style.use('fivethirtyeight')
def default_fig(**kwargs):
""" Genera... |
test_serialize.py | # Copyright (c) 2018, NVIDIA CORPORATION.
import sys
import atexit
import multiprocessing as mp
import numpy as np
import pandas as pd
from numba import cuda
try:
from distributed.protocol import serialize, deserialize
_have_distributed = True
except ImportError:
_have_distributed = False
import pytest
im... |
geoip.py | # Author : Pavel Vitis "blackdaemon"
# Email : blackdaemon@seznam.cz
#
# Copyright (c) 2010, Pavel Vitis <blackdaemon@seznam.cz>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1.... |
test_http.py | import json
import threading
import pytest
from six.moves.BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from testplan.testing import multitest
from testplan import Testplan
from testplan.common.utils.testing import argv_overridden
from testplan.exporters.testing import HTTPExporter
class PostHandler(Base... |
grab_api.py | # coding: utf-8
from grab import GrabMisuseError, GrabError
from grab.error import GrabTooManyRedirectsError
from grab.base import reset_request_counter
from test.util import build_grab
from test.util import BaseGrabTestCase
import six
import tempfile
import os
class GrabApiTestCase(BaseGrabTestCase):
def setUp(s... |
onioff.py | #!/usr/bin/env python3
# -.- coding: utf-8 -.-
# onioff.py
"""
Copyright (C) 2016-2018 Nikolaos Kamarinakis (nikolaskam@gmail.com)
See License at nikolaskama.me (https://nikolaskama.me/onioffproject)
"""
import socket, socks, requests, sys, os, time, optparse, datetime, re
from urllib.request import urlopen
from term... |
db.py | import functools
import sqlite3
import threading
from threading import Thread
from typing import Callable, Dict, Union
from util.types import Function
class Database(object):
"""Database wrapper."""
def __init__(self, path, debug=False):
# type: (str) -> None
self.path = path
se... |
concurrency_tests.py | from gevent import monkey
monkey.patch_all()
import gevent
import unittest
import time
import threading
import greenlet
from mongoengine.greenletutil import CLGreenlet
from mongoengine.tests.model.testdoc import TestDoc
from mongoengine.connection import connect
CONCURRENCY = 1000
LENGTH = 50000
SINGLE = False
def ... |
maxthreads.py | """
2016-03-28: Adding priority queues
2016-03-29: Changed how MaxThreads.stop works
2016-04-04: Added a join function and removed unused modules
2016-04-05: The priority variable in SetPrio can now be a tuple
2016-04-07: Changed name of start_thread to the more accurate add_task (the old name can still be used)
2016-0... |
mail.py | """
app.utils.mail
==============
Setup app's mailer.
"""
import typing as t
from threading import Thread
from flask import Flask, current_app
from flask_mail import Message
from app.extensions import mail
def _send_async_email(app: Flask, msg: Message) -> None:
with app.app_context():
mail.send(msg)
... |
main.py | #!/usr/bin/python
import paho.mqtt.client as paho
import psutil
import pywapi
import signal
import sys
import time
from threading import Thread
def interruptHandler(signal, frame):
sys.exit(0)
def on_publish(mosq, obj, msg):
pass
def dataNetwork():
netdata = psutil.net_io_counters()
return netdata.... |
driver.py | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# (c) Copyright 2013 Hewlett-Pa... |
processor.py | '''
the processor object that handles forward encryption and reverse decryption
__ __
/ \ ^ / \
\ / | \ /
| . | . |
\__A__/
\|. / | \ .|/
\+<| | |>+/
\ /|\ /
V===V
| |
___/ \___
sadpanda
by: alex balzer
'''
import pickle
import os
impor... |
commander.py | import multiprocessing
import os
from app.robot.toutiao_article import ToutiaoArticleRobot
from .robot_food import config as config_food
from .robot_history import config as config_history
from .robot_joke import config as config_joke
from .robot_pet import config as config_pet
from .robot_star import config as confi... |
regWin.py | # coding:utf-8
from setting.Key import Key
from setting.Server import Server
from lib.Systeminfo import Systeminfo
from lib.Singleton import *
import threading
import os
import lib.myCmd as mycmd
class RegWin(Singleton):
output_func = None
def __Singleton_Init__(self, output_func = print):
self.ou... |
base_controller.py | #!/usr/bin/env python3
import threading
import rospy
from std_msgs.msg import Float64, Int32
from sensor_msgs.msg import JointState
import time
class PD:
speed= 521
kp=5
kd=1
prev_err=0
def speed_from_angle(self, angle):
err=90-angle
der=self.prev_err-err
cont=self... |
xla_client_test.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... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
from test import support
from test.support import import_helper
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
from test.support import warnings_helper
import sock... |
yolo.py | # Follow these tutorial to install opencv
# https://qengineering.eu/install-opencv-4.5-on-raspberry-pi-4.html
import cv2
import numpy as np
import argparse
import time
from threading import Thread
import uuid
import os
import logging
import smtplib
import ssl
from datetime import datetime
parser = argparse.ArgumentP... |
__init__.py | #!/usr/bin/python3 -OO
# Copyright 2007-2019 The SABnzbd-Team <team@sabnzbd.org>
#
# 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 2
# of the License, or (at your option) any late... |
test_wasser.py | """Tests for wasser module"""
from multiprocessing import Process
from time import sleep
import unittest
import json
import sys
import ssl
import wasser
from simple_ssl_server import SimpleServer
class TestServer(SimpleServer):
"""Server for tests"""
def get(self, path):
if path == '/':
re... |
main.py | #!/usr/bin/env python
#_*_ coding:utf-8 _*_
import function
import time
from common import EmailNotify
from common import GetConfigList
import threading
lst = GetConfigList('stock_number')
def get_ene(stock_number,mutex):
while True:
realtimePrice = function.GetRealTimePrice(stock_number)
... |
test_gc.py | import unittest
from test.test_support import verbose, run_unittest
from test import test_support
import sys
import gc
import weakref
import time
try:
import threading
except ImportError:
threading = None
### Support code
###############################################################################
# Bug 1... |
new_file.py | import os
import cv2
import uuid
import time
from datetime import datetime
import numpy as np
from multiprocessing import Process, Value, Manager
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstVideo', '1.0')
from gi.repository import Gst, GObject, GLib, GstVideo
gi.require_version('GstWebRTC', '1... |
specter_desktop.py | from PyQt5.QtGui import QIcon, QCursor, QDesktopServices
from PyQt5.QtWidgets import QApplication, QSystemTrayIcon, QMenu, QAction, \
QDialog, QDialogButtonBox, QVBoxLayout, QRadioButton, QLineEdit, \
QFileDialog, QLabel, QWidget
from PyQt5.QtCore import QRunnable, QThreadPool, QSettings, QUrl, \
Qt, pyqtSi... |
callback.py | import Pyro4
import logging
Pyro4.config.REQUIRE_EXPOSE = True
log = logging.getLogger(__name__)
class CallbackServer(object):
def __init__(self, listen_port, remote_port):
self.daemon = Pyro4.Daemon(host='localhost', port=listen_port,
nathost='localhost', natport=remo... |
app.py | # encoding: utf-8
'''
A REST API for Salt
===================
.. versionadded:: 2014.7.0
.. py:currentmodule:: salt.netapi.rest_cherrypy.app
:depends:
- CherryPy Python module. Version 3.2.3 is currently recommended when
SSL is enabled, since this version worked the best with SSL in
internal testing.... |
Tools.py | from typing import List
from HueLight import HueLight
from HueDevice import HueDevice
import datetime
import json
from random import random
from Config import DEVICES_DEFINITION
from threading import Thread
from HueDevice import HueDevice
from flask_apscheduler import APScheduler
#### Bluetooth methods
###
# Check co... |
SquidNet2Admin.py | import socket,threading, os, sys, sqlite3,getpass
class Admin:
def logo(self):
logo = """
/\\
//\\\\
//__\\\\
//____\\\\
\\\____//
... |
blog-click-read-num.py | #!/usr/bin/env python
# encoding: utf-8
'''
#-------------------------------------------------------------------
# CONFIDENTIAL --- CUSTOM STUDIOS
#-------------------------------------------------------------------
# ... |
object.py | from .opencl import buffer, global_np_buffer
from .cl_program import CL_PROG
from threading import Event, Thread
from time import time
import numpy
class Object:
def __init__(self, buffer: buffer.Buffer, pos: (int, int) = (0,0), cl_prog: CL_PROG = None):
self.pos = pos
self.buffer = buffer
... |
perftool.py | #!/usr/bin/env python3
# Copyright (C) 2019 National Institute of Informatics
#
# 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 fil... |
start_lambda_api_integ_base.py | from unittest import TestCase, skipIf
import threading
from subprocess import Popen
import time
import os
import random
from pathlib import Path
from tests.testing_utils import SKIP_DOCKER_TESTS, SKIP_DOCKER_MESSAGE
@skipIf(SKIP_DOCKER_TESTS, SKIP_DOCKER_MESSAGE)
class StartLambdaIntegBaseClass(TestCase):
templ... |
pivideostream.py | # import the necessary packages
from picamera.array import PiRGBArray
from picamera import PiCamera
from threading import Thread
import cv2
class PiVideoStream:
def __init__(self, resolution=(320, 240), framerate=32, **kwargs):
# initialize the camera
self.camera = PiCamera()
# set camera parameters... |
__init__.py | # -*- coding: utf-8 -*-
'''
Set up the Salt integration test suite
'''
# Import Python libs
from __future__ import absolute_import, print_function
import os
import re
import sys
import copy
import time
import stat
import errno
import signal
import shutil
import pprint
import atexit
import socket
import logging
import... |
test_concurrent_futures.py | import test.support
# Skip tests if _multiprocessing wasn't built.
test.support.import_module('_multiprocessing')
# Skip tests if sem_open implementation is broken.
test.support.import_module('multiprocessing.synchronize')
# import threading after _multiprocessing to raise a more revelant error
# message: "No m... |
spin_thread.py | import threading
import time
from itertools import cycle
from random import randint
from requests import get
def spin(event):
for char in cycle('|/-\\'):
print(char, flush=True, end='\r')
if event.wait(1):
break
def download_any_image():
image = randint(200, 500)
response =... |
nu5.py | # -*- coding: utf-8 -*-
import LINETCR
from LINETCR.lib.curve.ttypes import *
from datetime import datetime
from bs4 import BeautifulSoup
import time, random, sys, re, os, json, subprocess, threading, string, codecs, requests, tweepy, ctypes, urllib, urllib2, wikipedia,tempfile,glob,shutil,unicodedata,goslate
from gtt... |
UbuntuChatCorpus.py | import glob
import sys
import time
from random import shuffle
from threading import Thread
import queue
import json
import torch
sys.path.append("..")
import params
from .vocab import PAD_TOKEN, UNKNOWN_TOKEN, DECODING_START, DECODING_END
class Batch(object):
def __init__(self, examples, vocab, struct_dist, dev... |
pushover_open_client.py | import json
import threading
import requests
import websocket
WEBSOCKET_URL = "wss://client.pushover.net/push"
BASE_URL = "https://api.pushover.net/1/"
LOGIN_URL = BASE_URL + "users/login.json"
DEVICE_URL = BASE_URL + "devices.json"
MESSAGES_URL = BASE_URL + "messages.json"
DELETE_URL = BASE_URL + "devices/" + "0000" ... |
MagiskPatcher.py | # 脚本 by affggh
import os
import sys
import subprocess
import tkinter as tk
from tkinter.filedialog import *
from tkinter import ttk
from tkinter import *
import time
import webbrowser
import threading
# Hide console , need ```pip install pywin32```
import win32gui, win32con
the_program_to_hide = win32gu... |
threading_lock.py | #
"""Controlling access to a resource using a Lock
"""
# end_pymotw_header
import logging
import random
import threading
import time
class Counter:
def __init__(self, start=0):
self.lock = threading.Lock()
self.value = start
def increment(self):
logging.debug("Waiting for lock")
... |
worker.py | __author__ = 'wanghao'
import subprocess
import threading
import SocketServer
import socket
import Pyro4
import sys
import os
class TCPHander(SocketServer.StreamRequestHandler):
def handle(self):
recv_data = ""
while 1:
data = self.request.recv(1024)
if not data:
... |
suggestionsEngine.py | import cloudserver
from threading import Thread
import time
import datetime
import csv
PUBLIC_SPACE = 0
BURKE_LAB = 1
TEHARANI_LAB = 2
JIANG_LAB = 3
SAJDA_LAB = 4
DANINO_LAB = 5
OFFICE_SPACE = 0
STUDENT_WORK_SPACE = 1
GENERAL_SPACE = 2
WINDOWED = True
NOT_WINDOWED = False
ACTIONABLE = True
NOT_ACTIONABLE = False
DUTY_... |
monitor.py | """
Copyright 2011 Greg Stein <gstein@gmail.com>
This file is provided to you 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... |
test_util.py | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import io
import locale
import os
import sys
import shutil
import pickle
import multiprocessing
import threading
import t... |
jobs.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
#... |
myui.py | #!/usr/bin/python
__author__ = "Stephane BARTHELEMY"
__copyright__ = "Copyright 2018, BARTHELEMY"
__credits__ = ["Stephane BARTHELEMY"]
__license__ = "MIT"
__version__ = "1.0"
__maintainer__ = __author__
__email__ = "stephane@sbarthelemy.com"
import os
import sys
from time import sleep
from pyA20.gpio import gpio
fro... |
test_asyncprocess.py | import asyncio
import gc
import os
import signal
import sys
import threading
import weakref
from datetime import timedelta
from time import sleep
import pytest
from tornado import gen
from tornado.locks import Event
from distributed.compatibility import WINDOWS
from distributed.metrics import time
from distributed.pr... |
test_logger.py | #!/usr/bin/env python
# Copyright (C) 2015 Swift Navigation Inc.
# Contact: https://support.swiftnav.com
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WA... |
runtests.py | #!/usr/bin/env python2.7
"""
Testing dec2flt
===============
These are *really* extensive tests. Expect them to run for hours. Due to the
nature of the problem (the input is a string of arbitrary length), exhaustive
testing is not really possible. Instead, there are exhaustive tests for some
classes of inputs for whic... |
VideoDisplay.py | # --coding--:utf-8 --
import cv2
import threading
from PyQt5.QtCore import QFile
from PyQt5.QtWidgets import QFileDialog, QMessageBox
from PyQt5.QtGui import QImage, QPixmap
import numpy as np
class Display:
def __init__(self, ui, mainWnd):
self.ui = ui
self.mainWnd = mainWnd
# 默认视频源为相机
... |
api.py | # -*- coding: utf-8 -*-
import importlib
import json
import logging
import pickle
import threading
import requests
from redis import StrictRedis
logger = logging.getLogger(__name__)
class CanNotGetConfError(Exception):
pass
class ConfInitError(Exception):
pass
def load_callbacks(callbacks):
"""
... |
log_parser.py | # -*- coding: UTF-8 -*-
"""
Copyright 2021 Tianshu AI Platform. 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 req... |
pipeline_ops_test.py | # Copyright 2020 Google LLC. 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 law or a... |
screen_diff.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... |
generic_ontology_etl.py |
"""Generic Ontology ETL."""
import logging
import multiprocessing
import re
from etl import ETL
from etl.helpers import OBOHelper
from files import TXTFile
from transactors import CSVTransactor
from transactors import Neo4jTransactor
class GenericOntologyETL(ETL):
"""Generic Ontology ETL."""
logger = logg... |
TCPClip.py | # TCPClip Class by DJATOM
# Version 2.4.0
# License: MIT
# Why? Mainly for processing on server 1 and encoding on server 2, but it's also possible to distribute filtering chain.
#
# Usage:
# Server side:
# from TCPClip import Server
# <your vpy code>
# Server('<ip addr>', <port>, get_output... |
clock.py | from datetime import datetime
import threading
import time
from . import injection
from . import i_lib
def now():
# seconds
return time.time()
def configure():
injection.bind(Clock).to(i_lib.Clock)
# All time quantities are in seconds.
class Clock(i_lib.Clock):
def __init__(self):
self._ev... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
from electrum_mue.bitcoin import TYPE_ADDRESS
from electrum_mue.storage import WalletStorage
from electrum_mue.wallet import Wallet, InternalAddressCorruption
from electrum_mue.paymentrequest import... |
test_logging.py | # Copyright 2001-2017 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this perm... |
snake2.py | #!/usr/bin/python3
"""
Program: Python Beginner Tutorial
Classic Snake Game - Part 2 (snake2.py)
Author: M. Heidenreich, (c) 2021
Description:
This code is provided in support of the following YouTube tutorial:
https://youtu.be/svffMjORYYU
This multi-part tutorial is a tool for ... |
tests.py | # Copyright 2021 RTBHOUSE. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
import json
import logging
import os
import threading
import time
import unittest
from datetime import datetime
from functools import wraps
from assertpy import assert_th... |
edit.py |
from utlis.rank import setrank ,isrank ,remrank ,setsudos ,remsudos ,setsudo
from handlers.delete import delete
from utlis.tg import Bot
from config import *
import threading, requests, time, random
def edit(client, message,redis):
userID = message.from_user.id
chatID = message.chat.id
rank = ... |
functional_tests.py | #!/usr/bin/env python
"""
This script cannot be run directly, because it needs to have test/functional/test_toolbox.py in sys.argv in
order to run functional tests on repository tools after installation. The install_and_test_tool_shed_repositories.sh
will execute this script with the appropriate parameters.
"""
import ... |
mouse_used.py | import logging
import threading
import time
import mouse
from flowd.metrics import BaseCollector
class MouseUsedCollector(BaseCollector):
"""
Mouse used
---
Seconds per minute
"""
metric_name = "Mouse Used (seconds)"
TIMEOUT_NOT_USED_SEC = 3
def __init__(self) -> None:
sel... |
commands.py | import sys
import base64
import argparse
import logging
from functools import partial
from itertools import cycle, repeat
from threading import Thread
from time import sleep
import json
import multiprocessing as mp
import coloredlogs
from websocket import create_connection
import bigchaindb_benchmark
from .utils imp... |
Driver_drowsiness_detection_project.py | import numpy as np
import cv2
import argparse
import imutils
import time
import dlib
#To detect and localize facial landmarks we need dlib package and knowing installation process of this package is important
import playsound
#playsound is imported for playing some small and simple sounds as alarms it can play MP3,WAV ... |
threadTests.py | import logging
import threading
import time
class ThreadTests:
def __init__(self):
self.lock = threading.Lock()
def thread_function(self, name):
self.lock.acquire()
logging.info("Function %s: starting", name)
time.sleep(2)
logging.info("Function %s: finishing", name)
... |
Spider.py | #coding=utf-8"
from flask import Flask,request, Response
from flask_restful import Resource
import os
from bson import json_util
import json
from bson import ObjectId
import pymongo
import subprocess
client = pymongo.MongoClient(host='127.0.0.1', port=27017)
db_list = client.list_database_names()
db = client.data
coll... |
pi_camera.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# ECE 5725 final project
# RPi Robot Mover
# Fall 2021
# Authors: Xu Hai (xh357), Yaqun Niu (yn232)
#
import time
import io
import threading
import picamera
import os
class Camera(object):
thread = None # background thread
frame = None # current frame
la... |
port_stealing.py | from scapy.all import *
from scapy.layers.l2 import getmacbyip
from netpyntest_lib.libs import mactools
from threading import Thread
import six
import signal
import sys
import ast
from os import getpid
from os import kill
from os import devnull
from termcolor import colored
pkts = []
file = None
run =... |
loader.py | from typing import Any, Callable, Iterable, Union
from itertools import tee
import queue
import sys
import threading
import numpy as np
import torch
from torch.utils.data import DataLoader
class ILoaderWrapper:
"""Loader wrapper interface.
Args:
loader: torch dataloader.
"""
def __init__(s... |
build_app.py | """Defines the builds route."""
from http import HTTPStatus
from threading import Thread
from nestor_api.config.config import Configuration
import nestor_api.lib.app as app
import nestor_api.lib.config as config
import nestor_api.lib.docker as docker
import nestor_api.lib.git as git
import nestor_api.lib.io as io
fro... |
ssh.py | import time
import sys
import os
from pexpect import pxssh
import argparse
import threading
method = 'ssh'
O = '\033[33m'
E = '\033[0m'
F = '\033[91m'
B = '\033[94m'
G = '\033[92m'
password_true = ''
parser = argparse.ArgumentParser()
parser.add_argument('host', help='Target host')
parser.add_argument('user', help='Ta... |
exchange_rate.py | from datetime import datetime
import inspect
import requests
import sys
import os
import json
import pkgutil
from threading import Thread
import time
import csv
import decimal
from decimal import Decimal as PyDecimal # Qt 5.12 also exports Decimal
from collections import defaultdict
from .bitcoin import COIN
from .i1... |
Paradis.py |
from colorama import init
from colorama import Fore, Back, Style
print( Fore.MAGENTA )
name = input ("----Nickname----:")
password = input ("----Password----:")
if password == "gg":
print ("----Hi " + name + ", good morning =D----")
else:
print("Неверный пароль")
exit()
print("--------... |
test_api.py | """
mbed SDK
Copyright (c) 2011-2014 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 applicable law or agreed to in wr... |
wbSerial.py | import serial
import serial.tools.list_ports
import time
import threading
import os
class WBSerial(object):
'''
单例类
主要负责串口通信: 连接,收发串口数据,处理串口数据
'''
# 初始化标志
_init_flag = False
# 是否开启控制台输出串口数据日志
_is_show_console = False
def __init__(self):
if WBSerial._init_flag:
... |
log_collector.py | #!/usr/bin/env python
# encoding: utf-8
import yaml
import threading
from zstacklib import *
from utils import linux
from utils import shell
from utils.sql_query import MySqlCommandLineQuery
from termcolor import colored
from datetime import datetime, timedelta
def info_verbose(*msg):
if len(msg) == 1:
o... |
pyshell.py | #! /usr/bin/env python3
import sys
if __name__ == "__main__":
sys.modules['idlelib.pyshell'] = sys.modules['__main__']
try:
from tkinter import *
except ImportError:
print("** IDLE can't import Tkinter.\n"
"Your Python may not be configured for Tk. **", file=sys.__stderr__)
raise SystemExit(... |
generic_ontology_etl.py |
"""Generic Ontology ETL."""
import logging
import multiprocessing
import re
from etl import ETL
from etl.helpers import OBOHelper
from files import TXTFile
from transactors import CSVTransactor
from transactors import Neo4jTransactor
class GenericOntologyETL(ETL):
"""Generic Ontology ETL."""
logger = logg... |
interact-socket-server-noblock.py | # Non-blocking interaction with a socket server child process, using a thread
# and a queue.
#
# Tested with Python 3.6
#
# Eli Bendersky [http://eli.thegreenplace.net]
# This code is in the public domain.
import queue
import socket
import subprocess
import threading
import time
def socket_reader(sockobj, outq, exit_... |
decode.py | import logging
import os
import signal
import socket
import sys
import threading
from datetime import datetime, timedelta, timezone
from operator import itemgetter
from pathlib import Path
from typing import (
Any,
Callable,
Dict,
Iterable,
Iterator,
List,
Optional,
TextIO,
Tuple,
... |
server_japronto.py | import os
import sys
import random
import ujson
import uuid
import uvloop
import asyncio
import asyncio_redis
import calendar
try:
sys.path.append(os.path.abspath('./'))
except Exception as e:
print(str(e.args))
exit(1)
from datetime import datetime, timedelta
from multiprocessing import Process, Queue
fr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.