source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
cli.py | # Adafruit MicroPython Tool - Command Line Interface
# Author: Tony DiCola
# Copyright (c) 2016 Adafruit Industries
#
# 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, incl... |
js_api.py | import webview
import threading
import time
import sys
import random
"""
This example demonstrates how to create a pywebview api without using a web
server
"""
html = """
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<style>
#response-container {
display: none;
padding: 3rem;
... |
thread.py | import logging
import threading
import time
import concurrent.futures
def thread_function(name):
logging.info("Thread %s: starting", name)
time.sleep(2)
logging.info("Thread %s: finishing", name)
def launch_one_daemon_thread():
logging.info("Main : before creating thread"... |
statSender.py | import pika
import sys
import socket
import struct
import binascii
import netifaces as ni
import pickle
import threading
import time
import logging
encoding = "utf-8"
class Messenger:
def __init__(self,server_address):
self.server_address = server_address
self.sock = socket.socket(socket.AF_INET,... |
signals.py | from datetime import timedelta
from django.dispatch import receiver
from django.db.models.signals import post_save
from django.contrib.auth import get_user_model
from django.utils import timezone
from django.utils.datetime_safe import datetime
from todo_app.models import Verification, Post
from todo_app.tasks import w... |
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... |
runtests.py | #!/usr/bin/python
##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
#
# Copyright 2015 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the "License");
# ... |
base_test.py | import haravan
from test.test_helper import TestCase
from pyactiveresource.activeresource import ActiveResource
from mock import patch
import threading
class BaseTest(TestCase):
@classmethod
def setUpClass(self):
self.session1 = haravan.Session('shop1.myharavan.com', 'token1')
self.session2 = ... |
test_sys.py | import builtins
import codecs
import gc
import locale
import operator
import os
import struct
import subprocess
import sys
import sysconfig
import test.support
from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok, assert_python_failure
from test.support imp... |
BRE_WHM.pyw | #BOT Recommendation Engine and Work Hour Monitor
import sqlite3
import os
import sys
import datetime
import time
from dateutil import parser
from pathlib import Path
import PySimpleGUI as sg
import traceback
import platform,socket,re,uuid,json,logging
from pynput.mouse import Listener as MouseListener
from pynput.keyb... |
old_client.py | import socket
import threading
import sys
import os
import json
class Client:
# creates socket using TCP
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# on client class init, connect to the ip address
# and port and send the session_url to the server
# to be added to the connections li... |
root.py | # External Dependencies
import threading
import time
from struct import pack, unpack
import queue
import numpy
# Internal Dependencies
from .packet import Packet
class Root(object):
"""Simplifies communication with a real Root robot.
Unless otherwise indicated, all methods are non-blocking.
Packets are s... |
flask_server.py | from datetime import datetime
import threading
from flask import Flask, request, jsonify
import os
import sys
import numpy as np
import json
import cv2
from maskrcnn_benchmark.config import cfg
from maskrcnn_benchmark.data import make_data_loader
from maskrcnn_benchmark.structures.bounding_box import BoxList
from pre... |
state.py | import logging
import pickle
import threading
import time
from typing import List
import schedule as schedule
from cryptography.fernet import Fernet, MultiFernet, InvalidToken
SCHEDULER_SLEEP_TIME = 1
REASONABLE_NUMBER_OF_KEYS = 500
class StateEncryptor(object):
def __init__(self, state_aging_tolerance: int = 1... |
base.py | # -*- coding: utf-8 -*-
'''
napalm-logs base
'''
from __future__ import absolute_import
# Import std lib
import os
import re
import imp
import sys
import time
import yaml
import logging
import threading
from multiprocessing import Process
# Import third party libs
try:
import sentry_sdk
HAS_SENTRY = True
exc... |
main.py | #!/usr/bin/env python3
'''
The main file to run. Process that runs indefinitely, and listens for button presses to start or stop the bark tracking.
'''
import datetime
import time
import signal
import sys
import logging
from threading import Thread, Event, Lock
from aiy.board import Board, Led
import aiy.voice.tts a... |
workflows_scaling.py | #!/usr/bin/env python
"""A small script to drive workflow performance testing.
% ./test/manual/launch_and_run.sh workflows_scaling --collection_size 500 --workflow_depth 4
$ .venv/bin/python scripts/summarize_timings.py --file /tmp/<work_dir>/handler1.log --pattern 'Workflow step'
$ .venv/bin/python scripts/summarize_... |
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... |
test_smtplib.py | import asyncore
import base64
import email.mime.text
from email.message import EmailMessage
from email.base64mime import body_encode as encode_base64
import email.utils
import hmac
import socket
import smtpd
import smtplib
import io
import re
import sys
import time
import select
import errno
import textwrap
import uni... |
test_stencilflow.py | #!/usr/bin/env python3
import multiprocessing as mp
import os
import sys
import json
import unittest
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
TEST_FOLDER = os.path.join(os.path.dirname(__file__), "stencils")
from stencilflow.bounded_queue import BoundedQueue
import dace.dtypes
class BoundedQueu... |
test_rand.py | from itertools import chain
import multiprocessing as mp
try:
from multiprocessing import SimpleQueue as MPQueue
except ImportError:
from multiprocessing.queues import SimpleQueue as MPQueue
import os
import threading
from ddtrace import Span
from ddtrace import tracer
from ddtrace.internal import _rand
fro... |
measure_throughput.py | import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
import argparse
import copy
import datetime
import json
import queue
import threading
import time
from job_id_pair import JobIdPair
from job_table import JobTable
from runtime.rpc import scheduler_server, sch... |
test_suite.py | #!/usr/bin/env python
# Copyright 1996-2019 Cyberbotics 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 applica... |
test_events.py | """Tests for events.py."""
import pytest
import collections.abc
import concurrent.futures
import functools
import gc
import io
import os
import platform
import re
import signal
import socket
try:
import ssl
except ImportError:
ssl = None
import subprocess
import sys
import threading
import time
import errno
im... |
input_server.py | # first to start the nameserver start: python -m Pyro4.naming
import Pyro4
from threading import Thread
import time
import numpy as np
from rlkit.launchers import config
# HOSTNAME = "192.168.0.102"
Pyro4.config.SERIALIZERS_ACCEPTED = set(['pickle','json', 'marshal', 'serpent'])
Pyro4.config.SERIALIZER='pickle'
devi... |
app.py |
from __future__ import print_function
import os
import socket
INSTANCE = os.environ.get('HOSTNAME', socket.gethostname())
DELAY = float(os.environ.get('SHUTDOWN_DELAY', 10.0))
from flask import Flask
READYRET=('OK', 200)
LIVERET=('OK', 200)
application = Flask(__name__)
@application.route('/ws/ready')
def ready(... |
PyNeuro.py | """
@Author Zach Wang
@Date 2021.9.27
@Version 1.2.1
"""
import json
from telnetlib import Telnet
from threading import Thread
class PyNeuro:
"""NeuroPy libraby, to get data from neurosky mindwave.
Initialising: object1=PyNeuro() #windows
After initialising , if required the callbacks must be set
then... |
scrapia_shell.py | """
3) For missing novels, add the functionality for pausing the code while it's running and scrape those missing novels first.
4) Sometimes `panels` in the `novel page` have different names for different novels, for them, create a json file for
storing what kind of a panel they have. For that save it as "str type"... |
main.py | import threading
import time
import pymysql
from module.crawling import *
from module.input_processing import *
from module.save_db import *
class main_ctrler():
def __init__(self):
self.input = input_data("config/link_hunter.sample_input.txt", "config/link_hunter.config",
"config/l... |
trustedcoin.py | #!/usr/bin/env python
#
# Electrum - Lightweight Bitcoin Client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... |
dht_msg.py | import sys
import random
import requests
import binascii
import umsgpack
from ast import literal_eval
from future.moves.urllib.parse import urlencode
#from multiprocessing import Process as Thread, Event
from threading import Thread, Event
from storjkademlia.node import Node as KadNode
from pyp2p.lib import is_ip_valid... |
client_ad_runner.py | import paho.mqtt.client as mqtt
from threading import Thread
from ast import literal_eval
import ADS1256
import config
from queue import Queue
from extract_data import run
class My_client_ad(Thread):
'''
Classe usada para representar um cliente ativo
Atributo-
--------
broker : ...... |
client.py | from email.utils import formatdate #required for formating date & time
from datetime import datetime #required to get current datetime for HTTP
from time import mktime,sleep #required for timestamp with zone
import tkinter #required for GUI
from tkinter import messagebo... |
daemons_test.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Bo Maryniuk <bo@suse.de>`
'''
# Import python libs
from __future__ import absolute_import
# Import Salt Testing libs
from salttesting import TestCase, skipIf
from salttesting.helpers import ensure_in_syspath
from salttesting.mock import patch, MagicMock, NO_MOCK, N... |
dynamodump.py | #!/usr/bin/env python
"""
Simple backup and restore script for Amazon DynamoDB using boto to work similarly to mysqldump.
Suitable for DynamoDB usages of smaller data volume which do not warrant the usage of AWS
Data Pipeline for backup/restores/empty.
dynamodump supports local DynamoDB instances as w... |
main.py | """
.. createdby: Darren Zhao Xie on 3/19/2019
.. currentmodule:: process_checker.main
Check if the process is running at certain time.
"""
import os
from threading import Thread
from time import sleep
from datetime import datetime
from process_checker.notifiers import Email
CHECK_ITI_FILE_PATH = '/path/to/file1'
CHE... |
utils.py | #================================================================
#
# File name : utils.py
# Author : PyLessons
# Created date: 2020-09-27
# Website : https://pylessons.com/
# GitHub : https://github.com/pythonlessons/TensorFlow-2.x-YOLOv3
# Description : additional yolov3 and yolov4 functio... |
baboon_problem.py | #!/usr/bin/env python
"""baboon_problem.py: Solve the baboon semaphore problem.
1. Once a baboon has begun to cross the canyon it is guaranteed to get across.
2. There are never more than 5 baboons on the rope
3. A continuing stream of baboons in one direction should not lock out the other
direction from crossing eve... |
util.py | # Copyright 2017 The Australian National University
#
# 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... |
app.py | """
A REST API for Salt
===================
.. py:currentmodule:: salt.netapi.rest_cherrypy.app
.. note::
This module is Experimental on Windows platforms and supports limited
configurations:
- doesn't support PAM authentication (i.e. external_auth: auto)
- doesn't support SSL (i.e. disable_ssl: Tru... |
Master.py | import socket
import time
from collections import defaultdict
from threading import RLock, Thread
import zmq
def nested_dict(n, type):
if n == 1:
return defaultdict(type)
else:
return defaultdict(lambda: nested_dict(n-1, type))
masterHeadFinished = 0
# masterDataFile = { ip1: ... |
test_run_example.py | """
This test tests whether starting a `run_ogcore_example.py` run of the model does
not break down (is still running) after 5 minutes or 300 seconds.
"""
import multiprocessing
import time
import os
import sys
import pandas as pd
import importlib.util
import shutil
from pathlib import Path
import pytest
def call_run... |
ioplotting.py | import time
import threading
import matplotlib.pyplot as plt
import math
global data
data = []
def dataInput():
start = time.time()
while True:
time.sleep(.03)
data.append(math.sin(time.time() - start)* (time.time() - start))
def plotter():
while True:
start = time.time()
... |
interrupt_rising.falling_queue.py | #!/usr/bin/python3
import RPi.GPIO as GPIO
import time
import queue as Queue # https://pymotw.com/2/Queue/
from functools import partial
from threading import Thread
#------------------------------------------------------------------------
# use the raspi board pin number
#GPIO.setmode(GPIO.BOARD)
# use the gpio numbe... |
a3c.py | """
NOTES
After upgrading pytorch to 2.0, the manual seed + span subprocessing (only choice in 2.7)
cause CUDA Error 3.
check the error issue: https://github.com/pytorch/pytorch/issues/2517
"""
from __future__ import print_function
from collections import deque
import time
import os
import torch
from torch.autograd im... |
helper.py | import asyncio
import functools
import inspect
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 collections.abc import MutableMapping
from datetime import datetime
from itertools import islic... |
main.py | from multiprocessing import Process, Pipe
import integration
import cv
if __name__ == '__main__':
# Creating pipes to send data between two processes
parent_conn, child_conn = Pipe()
# GUI component receives data
p1 = Process(target=integration.main, args=(parent_conn,))
# CV component sends data
... |
utils.py | import queue
import random
import socket
import time
from multiprocessing import Process
import gym
import numpy as np
import pyglet
from a2c.common.atari_wrappers import wrap_deepmind
from scipy.ndimage import zoom
# https://github.com/joschu/modular_rl/blob/master/modular_rl/running_stat.py
# http://www.johndcook... |
sna.py | from __future__ import print_function
import time
import threading
from pyLMS7002Soapy import pyLMS7002Soapy as pyLMSS
from flask import Flask, request
from flask_socketio import SocketIO
import webbrowser
from SingleToneSweeper import SingleToneSweeper
class SNA:
RUN_MODE_OFF = 0
RUN_MODE_ON = 1
RUN_MODE... |
task.py | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... |
coach.py | # Copyright (c) 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
from test import support
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import tempfile
import urllib.request
import traceback
import asyncore
import weakref
import platform
import functools
ssl =... |
app.py | ###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Miguel Grinberg
#
# Released under the MIT license
# https://github.com/miguelgrinberg/flask-video-streaming/blob/master/LICENSE
#
############################################################... |
custom.py | # pylint: disable=too-many-lines
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------... |
threadHandler.py | #This class initilazises 3 threads to deal with taks in paralllel to CNN inference
import sys
import socket
import traceback
import cv2
from imutils.video import VideoStream
import imagezmq
import threading
import numpy as np
import time
import cv2
from nacl.signing import VerifyKey
from nacl.signing import SigningKey
... |
sxdp_v1.py | '''
Date: Aug, 2017
S.Basu
'''
import os, sys, errno
import glob, time
import subprocess as sub
import h5py
import numpy as np
import multiprocessing as mp
import argparse, logging
import xds_input
import Merge_utls as merge
from cellprobe import Cell
from xscale_output import *
import matplotlib.pyplot as plt
cla... |
client.py | import json
import base64
from zipfile import ZipFile
import requests
import threading
from uuid import UUID
from os import urandom
from time import timezone, sleep
from typing import BinaryIO
from binascii import hexlify
from time import time as timestamp
from locale import getdefaultlocale as locale
from .lib.util... |
worker.py | ########
# Copyright (c) 2014 GigaSpaces Technologies 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... |
PowerUsageService.py | # -*- coding: utf-8 -*-
'''
@author: davandev
'''
import logging
import os
import traceback
import sys
import time
import davan.util.timer_functions as timer_functions
import davan.util.helper_functions as helper
import davan.config.config_creator as configuration
import davan.util.constants as constan... |
tiled.py | import time
from pathlib import Path
from collections import deque
from typing import Optional
import numpy as np
from lib.opengl.core.base import *
from lib.opengl import *
from lib.opengl.postproc import PostProcNode
from lib.gen.automaton import ClassicAutomaton
ASSET_PATH = Path(__file__).resolve().parent.parent... |
dos.py | import threading
import socket
import time
target= "target ip"
port=80
fake_ip="182.21.20.32"
def dos():
while True:
stream=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
stream.connect((target,port))
stream.sendto((f"GET /{target} HTTP/1.1\r\n").encode("ascii"),(target,port))... |
update_data.py | import threading, requests, time
from bot import log
class UpdateData(object):
def __init__(self):
self.unstable_req = None
self.req = None
self.results = None
thread = threading.Thread(target=self.run, args=())
thread.daemon = True
thread.start()
def run(self)... |
_env_runner.py | import copy
import logging
import os
import time
from multiprocessing import Process, Manager
from typing import Any
import numpy as np
from yarr.agents.agent import Agent
from yarr.envs.env import Env
from yarr.utils.rollout_generator import RolloutGenerator
from multiprocessing import get_start_method, set_start_met... |
interface.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... |
streaming.py | #!/usr/bin/env python3
# encoding: UTF-8
import os
import socket
import threading
from twisted.internet import reactor
from twisted.web.resource import Resource
from twisted.web.server import Site
from twisted.web.static import File
# from twisted.python import log
def set_files(files, serve_ip, serve_port):
... |
environment.py | """
Copyright (c) <2018> YoongiKim
See the file license.txt for copying permission.
"""
import numpy as np
import cv2
import time
import pyautogui
from RiderEnvironment.grabscreen import grab_screen
from RiderEnvironment import show_window
import threading
from RiderEnvironment import read_score
import gym
## PRESS... |
repl.py | """Interact with a Fish REPL.
"""
import os
import sys
import subprocess
from subprocess import PIPE
import time
from threading import Thread
import tempfile
try:
from queue import Queue
except ImportError:
from Queue import Queue
def write_thread(q, f):
while True:
data = q.get()
f.write(... |
camera.py | from threading import Thread
import numpy as np
import cv2
import imutils
import time
class Camera:
def __init__(self, src=0):
self.stream = cv2.VideoCapture(src)
(self.grabbed, self.frame) = self.stream.read()
self.stopped = False
time.sleep(1)
Thread(target=self.update... |
taricapi.py | from gevent import monkey # noqa: E402 # pylint: disable=C0411, C0412, C0413
monkey.patch_all() # noqa: E402 # pylint: disable=C0411, C0413
import datetime
import hashlib
import io
import json
from logging.config import dictConfig
import re
import signal
import threading
import uuid
from elasticapm.contrib.flas... |
test_selenium.py | import unittest
import threading
from selenium import webdriver
from app import create_app, db
from models.role import Role
from models.user import User
from models.category import Category
from utils.fake_util import FakeUtil
class SeleniumTestCase(unittest.TestCase):
client = None
@classmethod
def se... |
NmapAPI.py | import nmap
import threading
from tqdm import tqdm
from CoreUtils.Debug import Debug_Print
from Configuration.Configuration import APP_CONFIGURATION
class Nmapper:
def __init__(self):
self.scanner = nmap.PortScanner()
self.count = 0
self.flag = 0
def _quick_scan(self, target, port):
... |
serializers.py | import traceback
from threading import Thread
from rest_framework import serializers
from rest_framework.serializers import raise_errors_on_nested_writes
from rest_framework.utils import model_meta
from .models import *
from parsers .main_parsers import *
class AnalysisDetailSerializer(serializers.ModelSerializer... |
multiprocess1.py | import os, time, random
from multiprocessing import Process, Pool
def process():
print('current Process %s start ...' % os.getpid())
pid = os.fork()
if pid < 0:
print('error in fork')
elif pid == 0:
print('I am child process(%s) and my parent process is (%s)' % (os.getpid(), os.getppid... |
rfc2217_server.py | #!/usr/bin/env python
# (C) 2009 Chris Liechti <cliechti@gmx.net>
# redirect data from a TCP/IP connection to a serial port and vice versa
# using RFC 2217
import sys
import os
import threading
import time
import socket
import serial
import serial.rfc2217
import logging
class Redirector:
def __init__(self, seri... |
Utils.py | #
# Cython -- Things that don't belong
# anywhere else in particular
#
from __future__ import absolute_import
try:
from __builtin__ import basestring
except ImportError:
basestring = str
import os
import sys
import re
import io
import codecs
from contextlib import contextmanager
modification_ti... |
experiment_test.py | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
spotify_manager.py | import spotipy
import datastore
from spotipy.oauth2 import SpotifyOAuth
import threading
import time
import json
class UserDevice():
__slots__ = ['id', 'name', 'is_active']
def __init__(self, id, name, is_active):
self.id = id
self.name = name
self.is_active = is_active
class UserTrack... |
foo.py | # Python 3.3.3 and 2.7.6
# python fo.py
from threading import Thread
# Potentially useful thing:
# In Python you "import" a global variable, instead of "export"ing it when you declare it
# (This is probably an effort to make you feel bad about typing the word "global")
i = 0
def incrementingFunction():
glob... |
example.py | from threading import Thread
from rwmutex import RWLock
from time import sleep
lock = RWLock()
shared_resource = ""
def do_writes():
global lock
global shared_resource
print("writer thread waiting for write lock")
with lock.write:
print("writer thread received write lock")
for i in... |
Local.py | # Copyright 2007 by Tiago Antao <tiagoantao@gmail.com>. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Asynchronous local execution (DEPRECATED).
Supports multicore archite... |
udp_server.py | import socketserver
import threading
class serverUDP:
message = ''
class MyUDPHandler(socketserver.DatagramRequestHandler):
def handle(self):
self.wfile.write(serverUDP.message.encode())
def __init__(self, server_ip, server_port):
self.server_port = server_port
self.s... |
filter_long_models.py | #!/usr/bin/python3
import os, subprocess
from multiprocessing import Process, Semaphore
# https://stackoverflow.com/questions/32855812/create-a-compress-function-in-python
def compress(string):
if string == '': return ''
res = ""
count = 1
# Add in first character
res += string[0]
# Iterate thr... |
soleboxaccgen.py | #### made by: rtuna#4321 | @rTunaboss
#### Working on Python 3.8.0
print(r'''
____ ____ _ _ ______ __ __ _
| _ \ / __ \ | \ | ||___ / /\ \ \ / /(_)
| |_) || | | || \| | / / / \ \ \_/ / _ ___
| _ < | | | || . ` | / / / /\ \ \ / | | / _ \
| |_) || |__| || ... |
test_sft.py | from sys import path
import threading
import time
from sft.listener import SFTListener
from sft.client import SFTClientResponser
from sft.protocol.definition import SFTProtocols, SFTRoles
from hks_pylib.logger import Display
from hks_pylib.logger import StandardLoggerGenerator
from hks_pylib.logger.standard import St... |
camatrix_mult_test.py | from math import log10
from threading import Thread
from random import randint
from time import time
import unittest
from pprint import pprint
def threadCompare(A, B, i, j, maxi):
if maxi[0] < A[i][j] : maxi[0] = A[i][j]
if maxi[0] < B[i][j] : maxi[0] = B[i][j]
def threadOne_New(A, C, i, j, P):
C[i] = C[i]*10**(... |
test_enum.py | import enum
import doctest
import inspect
import os
import pydoc
import sys
import unittest
import threading
from collections import OrderedDict
from enum import Enum, IntEnum, StrEnum, EnumType, Flag, IntFlag, unique, auto
from enum import STRICT, CONFORM, EJECT, KEEP, _simple_enum, _test_simple_enum
from enum import ... |
model.py | # coding=utf-8
from __future__ import print_function
import logging, os, numbers, six, numpy, threading, inspect, time
from os.path import isfile
import PDE_Control.legacy.phi.fluidformat, phi.math.nd
from PDE_Control.legacy.phi.viz.plot import PlotlyFigureBuilder
def synchronized_method(method):
outer_lock = thr... |
test_operator_gpu.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... |
view_audio.py | #!/usr/bin/env python3
###################################################################################################
##
## Project: Embedded Learning Library (ELL)
## File: view_audio.py
## Authors: Chris Lovett, Chuck Jacobs
##
## Requires: Python 3.x
##
################################################... |
Camera.py | # Camera Class
# Brandon Joffe
# 2016
#
# Copyright 2016, Brandon Joffe, 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.... |
Local.py | # Copyright 2007 by Tiago Antao <tiagoantao@gmail.com>. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
'''
Asynchronous local execution.
Supports multicore architectures.
'''
... |
LogTool_Plugin.py | #!/usr/bin/python
# Copyright 2018 Arkady Shtempler.
#
# 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 ... |
base_strategy.py | from threading import Thread
from queue import Queue
import logging
from ...markets import market_watcher
from ...markets import market_simulator
from ...markets import market
from ...markets import position
from ...publishers.ticker import Ticker
strategies = []
logger = logging.getLogger(__name__)
class BaseStrate... |
dispatcher.py | from src.util import *
from threading import Thread
from time import sleep
from queue import Queue, Empty
import logging
# logging.basicConfig(filename='clab.log', format='%(asctime)s %(message)s --> ',datefmt='%d/%m/%Y %I:%M:%S %p', filemode='w', level=logging.DEBUG)
def MonitoringThread(in_queue, valid_hosts):
... |
brute.py | # source from only4skillers.eu
# edited by WP
import threading
import sys, os, re, time, socket
from Queue import *
from sys import stdout
if len(sys.argv) < 4:
print "Usage: python "+sys.argv[0]+" <list> <threads> <output file>"
sys.exit()
ips = open(sys.argv[1], "r").readlines()
threads = int(sys.argv[2])... |
media_player.py | """Support to interface with Sonos players. Extending Standard Sonos Component for static configuration"""
import pysonos.discovery as pysonosdiscover
import pysonos
import asyncio
import traceback
import threading
import homeassistant.components.sonos.media_player as sonosha
DEPENDENCIES = ('sonos',)
"""
Helper für... |
road_speed_limiter.py | import json
import threading
import time
import socket
import fcntl
import struct
from threading import Thread
from cereal import messaging
from common.params import Params
from common.numpy_fast import interp
current_milli_time = lambda: int(round(time.time() * 1000))
CAMERA_SPEED_FACTOR = 1.05
BROADCAST_PORT = 2... |
laser.py | #!/usr/bin/env python
# coding: utf-8
import time
import math
import pybullet
import threading
from qibullet.sensor import Sensor
RAY_MISS_COLOR = [0, 1, 0]
RAY_HIT_COLOR = [1, 0, 0]
NUM_RAY = 15
RAY_LENGTH = 3.0 # The theoretical length is 5.6, closer to 3.0 in reality
LASER_ANGLE = 60
LASER_POSITION = [
[0.056... |
phd2guider.py | # MIT License
# Copyright (c) 2017 Andy Galasso
# https://github.com/agalasso/phd2client/
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation t... |
main_ui.py | import logging, sys, signal, time, json, os, pytweening, threading
from collections import deque
from lib.vhWindows import vhWindows
from lib.vhSockets import vhSockets
from lib.vhUI import vhUI
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
#logger = logging.getLogger(__name__)
#logger.setLevel(logging.DE... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.